qdev: uglify qdev_set_prop_bin() to deal with qemu_malloc(0) aborting.
PATCH 1/1 qdev: uglify qdev_set_prop_bin() to deal with qemu_malloc(0) aborting.
Without that patch attempts to store zero-length binary attributes will kill qemu.
Incremental fix for the "qdev: add string and binary properties" patch.
Signed-off-by Gerd Hoffmann <[email protected]>
--- hw/qdev.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
hw/qdev.c +2 -1
@@ -166,7 +166,8 @@ void qdev_set_prop_bin(DeviceState *dev, const char *name, const uint8_t *bin, s prop =create_prop (dev, name); prop->type =PROP_BIN ; - prop->value.bin =qemu_malloc (len); +if (len) + prop->value.bin =qemu_malloc (len); prop->len = len;memcpy (prop->value.bin, bin, len); }
Signature · 1 line
1.6.2.2