Avoid a memory leak.
Submitted by: Dmitry Luhtionov via Alexander Motin MFC after: 1 week
This commit is contained in:
parent
92378cce77
commit
e02616caf0
@ -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
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user