In prop_data_create_data(blob, len), if len == 0, allocate no memory

for blob, and leave pd_mutable set to NULL.  In this way, avoid
tripping over the assertion in prop_data_data_nocopy().
This commit is contained in:
dyoung 2008-05-15 21:23:33 +00:00
parent f2c43a72d5
commit 848e7ffe8c

View File

@ -1,4 +1,4 @@
/* $NetBSD: prop_data.c,v 1.11 2008/04/28 20:22:53 martin Exp $ */
/* $NetBSD: prop_data.c,v 1.12 2008/05/15 21:23:33 dyoung Exp $ */
/*-
* Copyright (c) 2006 The NetBSD Foundation, Inc.
@ -224,7 +224,7 @@ prop_data_create_data(const void *v, size_t size)
void *nv;
pd = _prop_data_alloc();
if (pd != NULL) {
if (pd != NULL && size != 0) {
nv = _PROP_MALLOC(size, M_PROP_DATA);
if (nv == NULL) {
prop_object_release(pd);