From: Andrei Borzenkov Date: Mon, 26 Jan 2015 19:08:13 +0000 (+0300) Subject: linux/getroot: fix memory leak. X-Git-Tag: 2.02-beta3~476 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e61f4eba1850c1c6576c0977fc1a305ad02ab0ce;p=thirdparty%2Fgrub.git linux/getroot: fix memory leak. Found by: Coverity scan. --- diff --git a/grub-core/osdep/unix/getroot.c b/grub-core/osdep/unix/getroot.c index e3887cbea..10fb56a2b 100644 --- a/grub-core/osdep/unix/getroot.c +++ b/grub-core/osdep/unix/getroot.c @@ -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). */