Exit early if managed object is not found, instead of dereferencing
a NULL pointer and triggering a segfault.
#define ESX_VI__TEMPLATE__LOOKUP(_type, _complete_properties, \
- _cast_from_anytype) \
+ _cast_from_anytype) \
int \
esxVI_Lookup##_type(esxVI_Context *ctx, const char* name /* optional */, \
esxVI_ManagedObjectReference *root, \
goto cleanup; \
} \
\
+ if (objectContent == NULL) { \
+ /* not found, exit early */ \
+ result = 0; \
+ goto cleanup; \
+ } \
+ \
if (esxVI_##_type##_Alloc(ptrptr) < 0) { \
goto cleanup; \
} \