From: John Ferlan Date: Tue, 17 May 2016 14:31:16 +0000 (-0400) Subject: util: Fix error path for virPCIGetVirtualFunctions X-Git-Tag: v1.3.5-rc1~129 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1f1273c2d1fe71da87f5708c3308bc5fb20aa105;p=thirdparty%2Flibvirt.git 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 --- diff --git a/src/util/virpci.c b/src/util/virpci.c index 3f1252d42b..be35017dad 100644 --- a/src/util/virpci.c +++ b/src/util/virpci.c @@ -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; }