Always initialise *relroot in grub_find_root_device_from_mountinfo,

otherwise we free an uninitialised pointer if /proc is unmounted.
Reported by: Scott Moser.
This commit is contained in:
Colin Watson 2011-01-07 17:24:25 +00:00
parent 944404efb8
commit 11b970d7c9

View file

@ -111,13 +111,13 @@ grub_find_root_device_from_mountinfo (const char *dir, char **relroot)
size_t len = 0;
char *ret = NULL;
if (relroot)
*relroot = NULL;
fp = fopen ("/proc/self/mountinfo", "r");
if (! fp)
return NULL; /* fall through to other methods */
if (relroot)
*relroot = NULL;
while (getline (&buf, &len, fp) > 0)
{
int mnt_id, parent_mnt_id;