* grub-core/disk/diskfilter.c (free_array) [GRUB_UTIL]: Fix memory leak.

* util/getroot.c (grub_find_device): Likewise.
	(get_mdadm_uuid): Likewise.
	(grub_util_is_imsm): Likewise.
	(grub_util_pull_device): Likewise.
	* util/grub-probe.c (probe): Likewise.
This commit is contained in:
Vladimir 'phcoder' Serbinenko 2012-09-11 07:53:26 +02:00
parent 801a3027be
commit 592fd0e4d6
4 changed files with 24 additions and 2 deletions

View file

@ -1,3 +1,12 @@
2012-09-11 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/disk/diskfilter.c (free_array) [GRUB_UTIL]: Fix memory leak.
* util/getroot.c (grub_find_device): Likewise.
(get_mdadm_uuid): Likewise.
(grub_util_is_imsm): Likewise.
(grub_util_pull_device): Likewise.
* util/grub-probe.c (probe): Likewise.
2012-09-10 Benoit Gschwind <gschwind> 2012-09-10 Benoit Gschwind <gschwind>
* grub-core/loader/efi/appleloader.c (devpath_8): New var. * grub-core/loader/efi/appleloader.c (devpath_8): New var.

View file

@ -1130,6 +1130,9 @@ free_array (void)
grub_disk_close (pv->disk); grub_disk_close (pv->disk);
if (pv->id.uuidlen) if (pv->id.uuidlen)
grub_free (pv->id.uuid); grub_free (pv->id.uuid);
#ifdef GRUB_UTIL
grub_free (pv->partmaps);
#endif
grub_free (pv->internal_id); grub_free (pv->internal_id);
grub_free (pv); grub_free (pv);
} }

View file

@ -918,7 +918,10 @@ grub_find_device (const char *dir, dev_t dev)
grub files */ grub files */
if (strcmp(res, "/dev/root") == 0) if (strcmp(res, "/dev/root") == 0)
continue; {
free (res);
continue;
}
if (chdir (saved_cwd) < 0) if (chdir (saved_cwd) < 0)
grub_util_error ("%s", _("cannot restore the original directory")); grub_util_error ("%s", _("cannot restore the original directory"));
@ -1363,6 +1366,7 @@ get_mdadm_uuid (const char *os_dev)
out: out:
close (fd); close (fd);
waitpid (pid, NULL, 0); waitpid (pid, NULL, 0);
free (buf);
return name; return name;
} }
@ -1437,6 +1441,8 @@ grub_util_is_imsm (const char *os_dev)
} }
} }
free (buf);
return 0; return 0;
out: out:
@ -1577,7 +1583,10 @@ grub_util_pull_device (const char *os_dev)
char **devicelist = grub_util_raid_getmembers (os_dev, 0); char **devicelist = grub_util_raid_getmembers (os_dev, 0);
int i; int i;
for (i = 0; devicelist[i];i++) for (i = 0; devicelist[i];i++)
grub_util_pull_device (devicelist[i]); {
grub_util_pull_device (devicelist[i]);
free (devicelist[i]);
}
free (devicelist); free (devicelist);
} }
#endif #endif

View file

@ -474,6 +474,7 @@ probe (const char *path, char **device_names, char delim)
printf ("%s", label); printf ("%s", label);
putchar (delim); putchar (delim);
} }
grub_device_close (dev);
goto end; goto end;
} }