[gnome-panel] fish: nullify argv after freeing it



commit a3cbfe125cca6f89f1f77cb98ffd73e2915c33a7
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date:   Sun Mar 21 14:16:21 2021 +0200

    fish: nullify argv after freeing it
    
    Coverity thinks that we are using argv after freeing it. Looking
    at code this seems to be false positive. Try to avoid this by
    setting argv to NULL after freeing it. Also make sure that argv
    is initialized.
    
    Coverity CID: #1502701

 modules/fish/fish-applet.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/modules/fish/fish-applet.c b/modules/fish/fish-applet.c
index 1193285b9..0db45a8f9 100644
--- a/modules/fish/fish-applet.c
+++ b/modules/fish/fish-applet.c
@@ -352,6 +352,7 @@ locate_fortune_command (FishApplet   *fish,
                }
 
                g_strfreev (*argvp);
+               *argvp = NULL;
        }
 
        prog = g_find_program_in_path ("fortune");
@@ -367,7 +368,7 @@ locate_fortune_command (FishApplet   *fish,
 
        something_fishy_going_on (fish,
                                  _("Unable to locate the command to execute"));
-       *argvp = NULL;
+
        return FALSE;
 }
 
@@ -548,8 +549,10 @@ display_fortune_dialog (FishApplet *fish)
        fish->source_id = 0;
        fish_close_channel (fish);
 
+       argv = NULL;
        user_command = locate_fortune_command (fish, &argv);
-       if (!argv)
+
+       if (argv == NULL)
                return;
 
        if (!fish->fortune_dialog) {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]