From f826d914e2fc390b6e7b6767e6aefcea8dbe95a7 Mon Sep 17 00:00:00 2001 From: Andrei Borzenkov Date: Sat, 16 Jan 2016 21:47:28 +0300 Subject: [PATCH] grub-probe: fix memory leak Found by: Coverity scan. CID: 73783 --- util/grub-probe.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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++)