devmapper/getroot: Fix memory leak.

Found by: Coverity scan.
This commit is contained in:
Vladimir Serbinenko 2015-01-26 09:50:27 +01:00
parent 6603c22f31
commit c14dff3ca7

View file

@ -160,7 +160,10 @@ grub_util_pull_devmapper (const char *os_dev)
uuid = get_dm_uuid (os_dev); uuid = get_dm_uuid (os_dev);
if (!grub_util_open_dm (os_dev, &tree, &node)) if (!grub_util_open_dm (os_dev, &tree, &node))
return; {
grub_free (uuid);
return;
}
while ((child = dm_tree_next_child (&handle, node, 0))) while ((child = dm_tree_next_child (&handle, node, 0)))
{ {
@ -192,6 +195,7 @@ grub_util_pull_devmapper (const char *os_dev)
} }
else else
dm_tree_free (tree); dm_tree_free (tree);
grub_free (uuid);
} }
char * char *
@ -253,6 +257,7 @@ grub_util_get_devmapper_grub_dev (const char *os_dev)
grub_free (uuid); grub_free (uuid);
return grub_dev; return grub_dev;
} }
grub_free (uuid);
return NULL; return NULL;
} }
@ -279,6 +284,7 @@ grub_util_get_vg_uuid (const char *os_dev)
} }
optr--; optr--;
*optr = '\0'; *optr = '\0';
grub_free (uuid);
return vgid; return vgid;
} }