If esxVI_String_DeepCopyValue or esxVI_SelectionSpec_AppendToList fail
then selectionSpec would leak. Add a free call in the failure path to
fix the leak.
currentSelectSetName = selectSetNames;
while (currentSelectSetName != NULL && *currentSelectSetName != '\0') {
- selectionSpec = NULL;
-
if (esxVI_SelectionSpec_Alloc(&selectionSpec) < 0 ||
esxVI_String_DeepCopyValue(&selectionSpec->name,
currentSelectSetName) < 0 ||
goto failure;
}
+ selectionSpec = NULL;
currentSelectSetName += strlen(currentSelectSetName) + 1;
}
}
failure:
esxVI_TraversalSpec_Free(&traversalSpec);
+ esxVI_SelectionSpec_Free(&selectionSpec);
return -1;
}