diff options
author | mjacob <mjacob@FreeBSD.org> | 2010-08-13 15:17:19 +0000 |
---|---|---|
committer | mjacob <mjacob@FreeBSD.org> | 2010-08-13 15:17:19 +0000 |
commit | af324b1be078ccd5569e29a9f568c9dada7b9650 (patch) | |
tree | 3dbaea24e94e16adcc300e861f2ea09fd2eec2f9 /sbin/geom | |
parent | 392fc0c63d4e1a190c8fa3e7d5e1ca1c5058cf03 (diff) | |
download | FreeBSD-src-af324b1be078ccd5569e29a9f568c9dada7b9650.zip FreeBSD-src-af324b1be078ccd5569e29a9f568c9dada7b9650.tar.gz |
Avoid a memory leak.
Submitted by: Dmitry Luhtionov via Alexander Motin
MFC after: 1 week
Diffstat (limited to 'sbin/geom')
-rw-r--r-- | sbin/geom/class/multipath/geom_multipath.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/sbin/geom/class/multipath/geom_multipath.c b/sbin/geom/class/multipath/geom_multipath.c index 2d2cdaf..2d72362 100644 --- a/sbin/geom/class/multipath/geom_multipath.c +++ b/sbin/geom/class/multipath/geom_multipath.c @@ -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); |