diff options
author | Jim Meyering <meyering@redhat.com> | 2012-10-04 13:09:44 +0200 |
---|---|---|
committer | Anthony Liguori <aliguori@us.ibm.com> | 2012-10-05 07:58:36 -0500 |
commit | a5cf8262e4eb9c4646434e2c6211ef8608db3233 (patch) | |
tree | f77b60c58c43c2c8c079b3166de4b0141a3266dd /hw/sysbus.c | |
parent | a14c74928ba1fdaada515717f4d3c3fa3275d6f7 (diff) |
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/sysbus.c')
-rw-r--r-- | hw/sysbus.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/hw/sysbus.c b/hw/sysbus.c index 9d8b1eaf7d..c1738403dd 100644 --- a/hw/sysbus.c +++ b/hw/sysbus.c @@ -211,7 +211,7 @@ static char *sysbus_get_fw_dev_path(DeviceState *dev) snprintf(path + off, sizeof(path) - off, "@i%04x", s->pio[0]); } - return strdup(path); + return g_strdup(path); } void sysbus_add_memory(SysBusDevice *dev, target_phys_addr_t addr, |