From 7c23c34d38816d1d16ae6e1314280f06fe4d7706 Mon Sep 17 00:00:00 2001 From: Roopa Prabhu Date: Fri, 14 Oct 2011 15:25:28 -0700 Subject: [PATCH] Add missing strdup return value check Check strdup return value and fail if error Signed-off-by: Roopa Prabhu --- src/util/pci.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/util/pci.c b/src/util/pci.c index 2bbb90c0a6..33b4b0ee12 100644 --- a/src/util/pci.c +++ b/src/util/pci.c @@ -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; } -- GitLab