]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
grub-probe: fix memory leak
authorAndrei Borzenkov <arvidjaar@gmail.com>
Sat, 9 Jan 2016 10:49:37 +0000 (13:49 +0300)
committerAndrei Borzenkov <arvidjaar@gmail.com>
Sat, 9 Jan 2016 10:55:28 +0000 (13:55 +0300)
Found by: Coverity scan.
CID: 73783

util/grub-probe.c

index b1f533626aeaccdd8e5df5d7db12add300f87068..36b7f8bcbeb2f6b990bd11cf5cff156be61d2a45 100644 (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[] = {