libgeom(3): Use calloc instead of malloc and bzero.
Pull Request: https://github.com/freebsd/freebsd-src/pull/546 MFC after: 1 week Sponsored by: NVIDIA Networking
This commit is contained in:
parent
3322d1c0e2
commit
419822b372
@ -406,10 +406,9 @@ virstor_label(struct gctl_req *req)
|
||||
} else
|
||||
strlcpy(md.provider, name, sizeof(md.provider));
|
||||
}
|
||||
sect = malloc(ssize);
|
||||
sect = calloc(ssize, sizeof(unsigned char));
|
||||
if (sect == NULL)
|
||||
err(1, "Cannot allocate sector of %zu bytes", ssize);
|
||||
bzero(sect, ssize);
|
||||
virstor_metadata_encode(&md, sect);
|
||||
error = g_metadata_store(name, sect, ssize);
|
||||
free(sect);
|
||||
|
Loading…
Reference in New Issue
Block a user