diff options
author | Jim Meyering | 2012-10-04 13:09:44 +0200 |
---|---|---|
committer | Anthony Liguori | 2012-10-05 14:58:36 +0200 |
commit | a5cf8262e4eb9c4646434e2c6211ef8608db3233 (patch) | |
tree | f77b60c58c43c2c8c079b3166de4b0141a3266dd /hw/ide/qdev.c | |
parent | Merge remote-tracking branch 'sstabellini/xen-2012-10-03' into staging (diff) | |
download | qemu-a5cf8262e4eb9c4646434e2c6211ef8608db3233.tar.gz qemu-a5cf8262e4eb9c4646434e2c6211ef8608db3233.tar.xz qemu-a5cf8262e4eb9c4646434e2c6211ef8608db3233.zip |
scsi, pci, qdev, isa-bus, sysbus: don't let *_get_fw_dev_path return NULL
Use g_strdup rather than strdup, because the sole caller
(qdev_get_fw_dev_path_helper) assumes it gets non-NULL, and dereferences
it. Besides, in that caller, the allocated buffer is already freed with
g_free, so it's better to allocate with a matching g_strdup.
In one case, (scsi-bus.c) it was trivial, so I replaced an snprintf+
g_strdup combination with an equivalent g_strdup_printf use.
Signed-off-by: Jim Meyering <meyering@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'hw/ide/qdev.c')
-rw-r--r-- | hw/ide/qdev.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/hw/ide/qdev.c b/hw/ide/qdev.c index 5ea9b8f4b2..f2e4ea4207 100644 --- a/hw/ide/qdev.c +++ b/hw/ide/qdev.c @@ -60,7 +60,7 @@ static char *idebus_get_fw_dev_path(DeviceState *dev) snprintf(path, sizeof(path), "%s@%d", qdev_fw_name(dev), ((IDEBus*)dev->parent_bus)->bus_id); - return strdup(path); + return g_strdup(path); } static int ide_qdev_init(DeviceState *qdev) |