Some schemes can allocate memory for internal purposes but when

GEOM does withering this memory doesn't freed. Add G_PART_DESTROY
call to g_part_wither. Also add missed g_free() call to G_PART_READ
method for MBR and PC98 schemes.

Submitted by:	jh (previous version)
Reviewed by:	pjd
Approved by:	kib (mentor)
This commit is contained in:
Andrey V. Elsukov 2010-09-25 18:27:29 +00:00
parent 9eecfa1c33
commit b1da166ef1
3 changed files with 3 additions and 0 deletions

View file

@ -1273,6 +1273,7 @@ g_part_wither(struct g_geom *gp, int error)
table = gp->softc;
if (table != NULL) {
G_PART_DESTROY(table, NULL);
while ((entry = LIST_FIRST(&table->gpt_entry)) != NULL) {
LIST_REMOVE(entry, gpe_entry);
g_free(entry);

View file

@ -465,6 +465,7 @@ g_part_mbr_read(struct g_part_table *basetable, struct g_consumer *cp)
basetable->gpt_first = basetable->gpt_sectors;
basetable->gpt_last = msize - (msize % basetable->gpt_sectors) - 1;
g_free(buf);
return (0);
}

View file

@ -458,6 +458,7 @@ g_part_pc98_read(struct g_part_table *basetable, struct g_consumer *cp)
basetable->gpt_first = cyl;
basetable->gpt_last = msize - (msize % cyl) - 1;
g_free(buf);
return (0);
}