blob: Handle failure to alloc xattr on parse

Or rather, at least assert that the allocation failed.
This is not a recoverable error in general.

Change-Id: I9bc325066e829fc311ce84ce83536e9933ac5473
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
Ben Walker 2017-03-27 10:01:15 -07:00 committed by Daniel Verkamp
parent 88213615b6
commit abc73f6995

View File

@ -231,6 +231,7 @@ _spdk_blob_parse_page(const struct spdk_blob_md_page *page, struct spdk_blob *bl
assert(xattr != NULL);
xattr->name = malloc(desc_xattr->name_length + 1);
assert(xattr->name);
strncpy(xattr->name, desc_xattr->name, desc_xattr->name_length);
xattr->name[desc_xattr->name_length] = '\0';