Author: ae
Date: Sat Sep 25 18:27:29 2010
New Revision: 213174
URL: http://svn.freebsd.org/changeset/base/213174

Log:
  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)

Modified:
  head/sys/geom/part/g_part.c
  head/sys/geom/part/g_part_mbr.c
  head/sys/geom/part/g_part_pc98.c

Modified: head/sys/geom/part/g_part.c
==============================================================================
--- head/sys/geom/part/g_part.c Sat Sep 25 17:41:02 2010        (r213173)
+++ head/sys/geom/part/g_part.c Sat Sep 25 18:27:29 2010        (r213174)
@@ -1273,6 +1273,7 @@ g_part_wither(struct g_geom *gp, int err
 
        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);

Modified: head/sys/geom/part/g_part_mbr.c
==============================================================================
--- head/sys/geom/part/g_part_mbr.c     Sat Sep 25 17:41:02 2010        
(r213173)
+++ head/sys/geom/part/g_part_mbr.c     Sat Sep 25 18:27:29 2010        
(r213174)
@@ -465,6 +465,7 @@ g_part_mbr_read(struct g_part_table *bas
        basetable->gpt_first = basetable->gpt_sectors;
        basetable->gpt_last = msize - (msize % basetable->gpt_sectors) - 1;
 
+       g_free(buf);
        return (0);
 }
 

Modified: head/sys/geom/part/g_part_pc98.c
==============================================================================
--- head/sys/geom/part/g_part_pc98.c    Sat Sep 25 17:41:02 2010        
(r213173)
+++ head/sys/geom/part/g_part_pc98.c    Sat Sep 25 18:27:29 2010        
(r213174)
@@ -458,6 +458,7 @@ g_part_pc98_read(struct g_part_table *ba
        basetable->gpt_first = cyl;
        basetable->gpt_last = msize - (msize % cyl) - 1;
 
+       g_free(buf);
        return (0);
 }
 
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to