Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 2 Jun 2010 17:17:11 +0000 (UTC)
From:      Marius Strobl <marius@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r208746 - head/sys/geom/part
Message-ID:  <201006021717.o52HHB9V017373@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: marius
Date: Wed Jun  2 17:17:11 2010
New Revision: 208746
URL: http://svn.freebsd.org/changeset/base/208746

Log:
  Don't leak memory on destruction.
  
  Reviewed by:	marcel
  MFC after:	3 days

Modified:
  head/sys/geom/part/g_part_bsd.c
  head/sys/geom/part/g_part_gpt.c

Modified: head/sys/geom/part/g_part_bsd.c
==============================================================================
--- head/sys/geom/part/g_part_bsd.c	Wed Jun  2 15:46:37 2010	(r208745)
+++ head/sys/geom/part/g_part_bsd.c	Wed Jun  2 17:17:11 2010	(r208746)
@@ -240,6 +240,12 @@ g_part_bsd_create(struct g_part_table *b
 static int
 g_part_bsd_destroy(struct g_part_table *basetable, struct g_part_parms *gpp)
 {
+	struct g_part_bsd_table *table;
+
+	table = (struct g_part_bsd_table *)basetable;
+	if (table->bbarea != NULL)
+		g_free(table->bbarea);
+	table->bbarea = NULL;
 
 	/* Wipe the second sector to clear the partitioning. */
 	basetable->gpt_smhead |= 2;

Modified: head/sys/geom/part/g_part_gpt.c
==============================================================================
--- head/sys/geom/part/g_part_gpt.c	Wed Jun  2 15:46:37 2010	(r208745)
+++ head/sys/geom/part/g_part_gpt.c	Wed Jun  2 17:17:11 2010	(r208746)
@@ -486,6 +486,12 @@ g_part_gpt_create(struct g_part_table *b
 static int
 g_part_gpt_destroy(struct g_part_table *basetable, struct g_part_parms *gpp)
 {
+	struct g_part_gpt_table *table;
+
+	table = (struct g_part_gpt_table *)basetable;
+	if (table->hdr != NULL)
+		g_free(table->hdr);
+	table->hdr = NULL;
 
 	/*
 	 * Wipe the first 2 sectors as well as the last to clear the



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201006021717.o52HHB9V017373>