]> xenbits.xensource.com Git - libvirt.git/commitdiff
virPCIGetNetName: Initialize @netname to NULL
authorMichal Privoznik <mprivozn@redhat.com>
Wed, 23 Jan 2019 09:38:48 +0000 (10:38 +0100)
committerMichal Privoznik <mprivozn@redhat.com>
Thu, 24 Jan 2019 09:02:31 +0000 (10:02 +0100)
This is a return argument that is to be compared against NULL on
successful return. However, it is not initialized and therefore
relies on callers setting it to NULL prior calling the function.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
src/util/virnetdev.c
src/util/virpci.c

index 92ef008ca12ee8e69da1c521e3b1ea2e885d34d3..f3e3d442ed0bbccdb9fd5260fbad4de98db86cdf 100644 (file)
@@ -1445,8 +1445,6 @@ virNetDevGetVirtualFunctionInfo(const char *vfname, char **pfname,
 {
     int ret = -1;
 
-    *pfname = NULL;
-
     if (virNetDevGetPhysicalFunction(vfname, pfname) < 0)
         return -1;
 
index 537876bcba2635bba81cba58704a07cd6016c492..ef578bf77473b3d96886d5d983ecb1290f35cdc3 100644 (file)
@@ -2853,6 +2853,8 @@ virPCIGetNetName(const char *device_link_sysfs_path,
     struct dirent *entry = NULL;
     size_t i = 0;
 
+    *netname = NULL;
+
     if (virBuildPath(&pcidev_sysfs_net_path, device_link_sysfs_path,
                      "net") == -1) {
         virReportOOMError();