svn commit: r210058 - head/sbin/geom/class/virstor
Alexander Motin
mav at FreeBSD.org
Wed Jul 14 15:14:01 UTC 2010
Author: mav
Date: Wed Jul 14 15:14:00 2010
New Revision: 210058
URL: http://svn.freebsd.org/changeset/base/210058
Log:
Do not bzero() NULL pointer on malloc() error.
Submitted by: Dmitry Luhtionov
Modified:
head/sbin/geom/class/virstor/geom_virstor.c
Modified: head/sbin/geom/class/virstor/geom_virstor.c
==============================================================================
--- head/sbin/geom/class/virstor/geom_virstor.c Wed Jul 14 15:11:29 2010 (r210057)
+++ head/sbin/geom/class/virstor/geom_virstor.c Wed Jul 14 15:14:00 2010 (r210058)
@@ -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);
More information about the svn-src-head
mailing list