* [Qemu-devel] [PATCH] qdev: uglify qdev_set_prop_bin() to deal with qemu_malloc(0) aborting.
@ 2009-05-29 18:54 Gerd Hoffmann
0 siblings, 0 replies; only message in thread
From: Gerd Hoffmann @ 2009-05-29 18:54 UTC (permalink / raw)
To: qemu-devel; +Cc: Gerd Hoffmann
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 <kraxel@redhat.com>
---
hw/qdev.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/hw/qdev.c b/hw/qdev.c
index 74a2892..62cff6b 100644
--- a/hw/qdev.c
+++ b/hw/qdev.c
@@ -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);
}
--
1.6.2.2
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2009-05-29 18:54 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-05-29 18:54 [Qemu-devel] [PATCH] qdev: uglify qdev_set_prop_bin() to deal with qemu_malloc(0) aborting Gerd Hoffmann
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).