]> git.proxmox.com Git - grub2.git/commitdiff
script: fix memory leak
authorAndrei Borzenkov <arvidjaar@gmail.com>
Tue, 12 Jan 2016 19:50:30 +0000 (22:50 +0300)
committerAndrei Borzenkov <arvidjaar@gmail.com>
Tue, 12 Jan 2016 19:50:30 +0000 (22:50 +0300)
Found by: Coverity scan.
CID: 96637

grub-core/script/execute.c

index bb70ebf175dc619f6a7c0de05a71eabb017b2b34..a8502d90711153adf6c09294ca9c1a049ba8d69f 100644 (file)
@@ -681,18 +681,14 @@ grub_script_arglist_to_argv (struct grub_script_arglist *arglist,
                              }
                            *op = '\0';
 
-                           if (grub_script_argv_append (&result, p, op - p))
-                             {
-                               grub_free (p);
-                               need_cleanup = 1;
-                               /* Fall through to cleanup */
-                             }
+                           need_cleanup = grub_script_argv_append (&result, p, op - p);
+                           grub_free (p);
+                           /* Fall through to cleanup */
                          }
                        else
                          {
-                           if (append (&result, values[i], 1))
-                             need_cleanup = 1;
-                             /* Fall through to cleanup */
+                           need_cleanup = append (&result, values[i], 1);
+                           /* Fall through to cleanup */
                          }
                      }