mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-07 01:33:56 -06:00
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>
This commit is contained in:
parent
a14c74928b
commit
a5cf8262e4
6 changed files with 7 additions and 11 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue