Do not bzero() NULL pointer on malloc() error.
Submitted by: Dmitry Luhtionov
This commit is contained in:
parent
b744190698
commit
bb160d3d4b
@ -459,9 +459,9 @@ virstor_label(struct gctl_req *req)
|
||||
strlcpy(md.provider, name, sizeof(md.provider));
|
||||
}
|
||||
sect = malloc(ssize);
|
||||
bzero(sect, ssize);
|
||||
if (sect == NULL)
|
||||
err(1, "Cannot allocate sector of %zu bytes", ssize);
|
||||
bzero(sect, ssize);
|
||||
virstor_metadata_encode(&md, sect);
|
||||
error = my_g_metadata_store(name, sect, ssize);
|
||||
free(sect);
|
||||
|
Loading…
Reference in New Issue
Block a user