grub-probe: fix memory leak
Found by: Coverity scan. CID: 73783
This commit is contained in:
parent
77002c65d3
commit
f826d914e2
1 changed files with 3 additions and 2 deletions
|
@ -279,7 +279,7 @@ probe (const char *path, char **device_names, char delim)
|
||||||
printf ("%s", *curdev);
|
printf ("%s", *curdev);
|
||||||
putchar (delim);
|
putchar (delim);
|
||||||
}
|
}
|
||||||
return;
|
goto free_device_names;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (print == PRINT_DISK)
|
if (print == PRINT_DISK)
|
||||||
|
@ -297,7 +297,7 @@ probe (const char *path, char **device_names, char delim)
|
||||||
putchar (delim);
|
putchar (delim);
|
||||||
free (disk);
|
free (disk);
|
||||||
}
|
}
|
||||||
return;
|
goto free_device_names;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (curdev = device_names; *curdev; curdev++)
|
for (curdev = device_names; *curdev; curdev++)
|
||||||
|
@ -669,6 +669,7 @@ probe (const char *path, char **device_names, char delim)
|
||||||
free (*curdrive);
|
free (*curdrive);
|
||||||
free (drives_names);
|
free (drives_names);
|
||||||
|
|
||||||
|
free_device_names:
|
||||||
if (path != NULL)
|
if (path != NULL)
|
||||||
{
|
{
|
||||||
for (curdev = device_names; *curdev; curdev++)
|
for (curdev = device_names; *curdev; curdev++)
|
||||||
|
|
Loading…
Reference in a new issue