]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
linux/getroot: fix memory leak.
authorAndrei Borzenkov <arvidjaar@gmail.com>
Mon, 26 Jan 2015 19:08:13 +0000 (22:08 +0300)
committerAndrei Borzenkov <arvidjaar@gmail.com>
Mon, 26 Jan 2015 20:04:09 +0000 (23:04 +0300)
Found by: Coverity scan.

grub-core/osdep/unix/getroot.c

index e3887cbea68917f6bdcb89288c563e076d198cd4..10fb56a2b1429677fc7e3509e9f8ace395083bc6 100644 (file)
@@ -621,7 +621,10 @@ grub_util_pull_lvm_by_command (const char *os_dev)
   free (vgname);
 
   if (!pid)
-    return;
+    {
+      free (vgid);
+      return;
+    }
 
   /* Parent.  Read vgs' output.  */
   vgs = fdopen (fd, "r");
@@ -653,6 +656,7 @@ out:
   close (fd);
   waitpid (pid, NULL, 0);
   free (buf);
+  free (vgid);
 }
 
 /* ZFS has similar problems to those of btrfs (see above).  */