]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
Add missing strdup return value check
authorRoopa Prabhu <roprabhu@cisco.com>
Fri, 14 Oct 2011 22:25:28 +0000 (15:25 -0700)
committerEric Blake <eblake@redhat.com>
Fri, 14 Oct 2011 23:18:37 +0000 (17:18 -0600)
Check strdup return value and fail if error

Signed-off-by: Roopa Prabhu <roprabhu@cisco.com>
src/util/pci.c

index 2bbb90c0a6e92ad5be4a7ac267d4f56a3a565dd6..33b4b0ee12cef571bfa8d3ae7f34c61fa868d668 100644 (file)
@@ -2018,7 +2018,10 @@ pciDeviceNetName(char *device_link_sysfs_path, char **netname)
 
             /* Assume a single directory entry */
             *netname = strdup(entry->d_name);
-            ret = 0;
+            if (!*netname)
+                virReportOOMError();
+            else
+                ret = 0;
             break;
      }