diff --git a/util/grub-probe.c b/util/grub-probe.c index 36b7f8bcb..8ac527d2f 100644 --- a/util/grub-probe.c +++ b/util/grub-probe.c @@ -279,7 +279,7 @@ probe (const char *path, char **device_names, char delim) printf ("%s", *curdev); putchar (delim); } - return; + goto free_device_names; } if (print == PRINT_DISK) @@ -297,7 +297,7 @@ probe (const char *path, char **device_names, char delim) putchar (delim); free (disk); } - return; + goto free_device_names; } for (curdev = device_names; *curdev; curdev++) @@ -669,6 +669,7 @@ probe (const char *path, char **device_names, char delim) free (*curdrive); free (drives_names); +free_device_names: if (path != NULL) { for (curdev = device_names; *curdev; curdev++)