grub-probe: fix memory leak

Found by: Coverity scan.
CID: 73783
This commit is contained in:
Andrei Borzenkov 2016-01-09 13:49:37 +03:00
parent fa2af21ec8
commit d5cc487d39

View file

@ -668,6 +668,13 @@ probe (const char *path, char **device_names, char delim)
for (curdrive = drives_names; *curdrive; curdrive++)
free (*curdrive);
free (drives_names);
if (path != NULL)
{
for (curdev = device_names; *curdev; curdev++)
free (*curdev);
free (device_names);
}
}
static struct argp_option options[] = {