svn commit: r215917 - stable/8/sbin/geom/class/multipath
Matt Jacob
mjacob at FreeBSD.org
Sat Nov 27 00:26:08 UTC 2010
Author: mjacob
Date: Sat Nov 27 00:26:08 2010
New Revision: 215917
URL: http://svn.freebsd.org/changeset/base/215917
Log:
This is an MFC of 211282
Avoid a memory leak.
Modified:
stable/8/sbin/geom/class/multipath/geom_multipath.c
Directory Properties:
stable/8/sbin/geom/class/multipath/ (props changed)
Modified: stable/8/sbin/geom/class/multipath/geom_multipath.c
==============================================================================
--- stable/8/sbin/geom/class/multipath/geom_multipath.c Sat Nov 27 00:23:55 2010 (r215916)
+++ stable/8/sbin/geom/class/multipath/geom_multipath.c Sat Nov 27 00:26:08 2010 (r215917)
@@ -149,16 +149,6 @@ mp_label(struct gctl_req *req)
}
/*
- * Allocate a sector to write as metadata.
- */
- sector = malloc(secsize);
- if (sector == NULL) {
- gctl_error(req, "unable to allocate metadata buffer");
- return;
- }
- memset(sector, 0, secsize);
-
- /*
* Generate metadata.
*/
strlcpy(md.md_magic, G_MULTIPATH_MAGIC, sizeof(md.md_magic));
@@ -191,6 +181,16 @@ mp_label(struct gctl_req *req)
}
/*
+ * Allocate a sector to write as metadata.
+ */
+ sector = malloc(secsize);
+ if (sector == NULL) {
+ gctl_error(req, "unable to allocate metadata buffer");
+ return;
+ }
+ memset(sector, 0, secsize);
+
+ /*
* encode the metadata
*/
multipath_metadata_encode(&md, sector);
More information about the svn-src-stable
mailing list