[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH] qdev: uglify qdev_set_prop_bin() to deal with qemu_
From: |
Gerd Hoffmann |
Subject: |
[Qemu-devel] [PATCH] qdev: uglify qdev_set_prop_bin() to deal with qemu_malloc(0) aborting. |
Date: |
Fri, 29 May 2009 20:54:16 +0200 |
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 <address@hidden>
---
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
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Qemu-devel] [PATCH] qdev: uglify qdev_set_prop_bin() to deal with qemu_malloc(0) aborting.,
Gerd Hoffmann <=