Avoid a memory leak.

Submitted by:	Dmitry Luhtionov via Alexander Motin
MFC after:	1 week
This commit is contained in:
Matt Jacob 2010-08-13 15:17:19 +00:00
parent 92378cce77
commit e02616caf0

View File

@ -148,16 +148,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.
*/
@ -190,6 +180,16 @@ mp_label(struct gctl_req *req)
return;
}
/*
* 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
*/