mirror of https://gitee.com/openkylin/libvirt.git
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:
parent
7b6116fb89
commit
6a8c174902
src/util
|
@ -1445,8 +1445,6 @@ virNetDevGetVirtualFunctionInfo(const char *vfname, char **pfname,
|
|||
{
|
||||
int ret = -1;
|
||||
|
||||
*pfname = NULL;
|
||||
|
||||
if (virNetDevGetPhysicalFunction(vfname, pfname) < 0)
|
||||
return -1;
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
|
Loading…
Reference in New Issue