Author: mjacob Date: Fri Aug 13 15:17:19 2010 New Revision: 211282 URL: http://svn.freebsd.org/changeset/base/211282
Log: Avoid a memory leak. Submitted by: Dmitry Luhtionov via Alexander Motin MFC after: 1 week Modified: head/sbin/geom/class/multipath/geom_multipath.c Modified: head/sbin/geom/class/multipath/geom_multipath.c ============================================================================== --- head/sbin/geom/class/multipath/geom_multipath.c Fri Aug 13 13:36:18 2010 (r211281) +++ head/sbin/geom/class/multipath/geom_multipath.c Fri Aug 13 15:17:19 2010 (r211282) @@ -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); _______________________________________________ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"