Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 11 Jun 2010 21:54:06 +0000 (UTC)
From:      Marius Strobl <marius@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
Subject:   svn commit: r209074 - stable/7/sys/geom/part
Message-ID:  <201006112154.o5BLs6sX000784@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: marius
Date: Fri Jun 11 21:54:06 2010
New Revision: 209074
URL: http://svn.freebsd.org/changeset/base/209074

Log:
  MFC: r208746
  
  Don't leak memory on destruction.
  
  Reviewed by:	marcel
  Approved by:    re (kib)

Modified:
  stable/7/sys/geom/part/g_part_bsd.c
  stable/7/sys/geom/part/g_part_gpt.c
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/cddl/contrib/opensolaris/   (props changed)
  stable/7/sys/contrib/dev/acpica/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/geom/part/g_part_bsd.c
==============================================================================
--- stable/7/sys/geom/part/g_part_bsd.c	Fri Jun 11 21:54:04 2010	(r209073)
+++ stable/7/sys/geom/part/g_part_bsd.c	Fri Jun 11 21:54:06 2010	(r209074)
@@ -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: stable/7/sys/geom/part/g_part_gpt.c
==============================================================================
--- stable/7/sys/geom/part/g_part_gpt.c	Fri Jun 11 21:54:04 2010	(r209073)
+++ stable/7/sys/geom/part/g_part_gpt.c	Fri Jun 11 21:54:06 2010	(r209074)
@@ -454,6 +454,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?201006112154.o5BLs6sX000784>