1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-01-30 01:47:24 +03:00

util: Fix error path for virPCIGetVirtualFunctions

If we get to the error: label and clear out the *virtual_functions[]
pointers and then return w/ error to the caller - the caller has it's
own cleanup of the same array in the out: label which is keyed off the
value of num_virt_fns, which wasn't reset to 0 in the called function
leading to a possible problem.

Just clear the value (found by Coverity)

Signed-off-by: John Ferlan <jferlan@redhat.com>
This commit is contained in:
John Ferlan 2016-05-17 10:31:16 -04:00
parent ee814d0ec4
commit 1f1273c2d1

View File

@ -2573,6 +2573,7 @@ virPCIGetVirtualFunctions(const char *sysfs_path,
for (i = 0; i < *num_virtual_functions; i++)
VIR_FREE((*virtual_functions)[i]);
VIR_FREE(*virtual_functions);
*num_virtual_functions = 0;
goto cleanup;
}