From 1208e6e48843620ecb21465394807c39d62b8e3e Mon Sep 17 00:00:00 2001 From: Jiri Denemark Date: Fri, 20 Aug 2010 13:53:54 +0200 Subject: [PATCH] qemu: Check for errors when converting PCI address to string --- src/qemu/qemu_conf.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c index fb85220860..c7ed0a336b 100644 --- a/src/qemu/qemu_conf.c +++ b/src/qemu/qemu_conf.c @@ -2096,6 +2096,8 @@ static int qemuCollectPCIAddress(virDomainDefPtr def ATTRIBUTE_UNUSED, if (dev->type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI) { char *addr = qemuPCIAddressAsString(dev); + if (!addr) + return -1; VIR_DEBUG("Remembering PCI addr %s", addr); @@ -2239,7 +2241,8 @@ int qemuDomainPCIAddressSetNextAddr(qemuDomainPCIAddressSetPtr addrs, maybe.addr.pci.bus = 0; maybe.addr.pci.slot = i; - addr = qemuPCIAddressAsString(&maybe); + if (!(addr = qemuPCIAddressAsString(&maybe))) + return -1; if (virHashLookup(addrs->used, addr)) { VIR_DEBUG("PCI addr %s already in use", addr);