virPCIGetNetName: Initialize @netname to NULL

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>
This commit is contained in:
Michal Privoznik 2019-01-23 10:38:48 +01:00
parent 7b6116fb89
commit 6a8c174902
2 changed files with 2 additions and 2 deletions

View File

@ -1445,8 +1445,6 @@ virNetDevGetVirtualFunctionInfo(const char *vfname, char **pfname,
{ {
int ret = -1; int ret = -1;
*pfname = NULL;
if (virNetDevGetPhysicalFunction(vfname, pfname) < 0) if (virNetDevGetPhysicalFunction(vfname, pfname) < 0)
return -1; return -1;

View File

@ -2853,6 +2853,8 @@ virPCIGetNetName(const char *device_link_sysfs_path,
struct dirent *entry = NULL; struct dirent *entry = NULL;
size_t i = 0; size_t i = 0;
*netname = NULL;
if (virBuildPath(&pcidev_sysfs_net_path, device_link_sysfs_path, if (virBuildPath(&pcidev_sysfs_net_path, device_link_sysfs_path,
"net") == -1) { "net") == -1) {
virReportOOMError(); virReportOOMError();