From 2087ede32d444bc72c337766780f86af28ce2d87 Mon Sep 17 00:00:00 2001 From: Andreas Mohr Date: Thu, 17 Feb 2022 18:16:32 +0000 Subject: [PATCH] (file_mask_dialog): NULLify variables before use in next iteration. Found by Coverity. Coverity id #331828 Coverity id #331850 Signed-off-by: Andreas Mohr Signed-off-by: Andrew Borodin --- src/filemanager/filegui.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/filemanager/filegui.c b/src/filemanager/filegui.c index c74177d59..ffca554b3 100644 --- a/src/filemanager/filegui.c +++ b/src/filemanager/filegui.c @@ -1277,7 +1277,8 @@ file_mask_dialog (file_op_context_t * ctx, FileOperation operation, gboolean onl vfs_path_t *vpath; gboolean source_easy_patterns = easy_patterns; char fmd_buf[BUF_MEDIUM]; - char *dest_dir, *tmp; + char *dest_dir = NULL; + char *tmp; char *def_text_secure; if (ctx == NULL) @@ -1329,7 +1330,8 @@ file_mask_dialog (file_op_context_t * ctx, FileOperation operation, gboolean onl } { - char *source_mask, *orig_mask; + char *source_mask = NULL; + char *orig_mask; int val; struct stat buf; @@ -1409,8 +1411,8 @@ file_mask_dialog (file_op_context_t * ctx, FileOperation operation, gboolean onl if (ctx->search_handle == NULL) { message (D_ERROR, MSG_ERROR, _("Invalid source pattern '%s'"), source_mask); - g_free (dest_dir); - g_free (source_mask); + MC_PTR_FREE (dest_dir); + MC_PTR_FREE (source_mask); goto ask_file_mask; } -- 2.11.4.GIT