Date: Fri, 13 Aug 2010 15:17:19 +0000 (UTC) From: Matt Jacob <mjacob@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r211282 - head/sbin/geom/class/multipath Message-ID: <201008131517.o7DFHJFe038098@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
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);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201008131517.o7DFHJFe038098>