// Allocate buffer for layer names
props->component_layer_names =
loader_instance_heap_alloc(inst, sizeof(char[MAX_STRING_SIZE]) * count, VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE);
- if (NULL == props->component_layer_names) {
+ if (NULL == props->component_layer_names && count > 0) {
result = VK_ERROR_OUT_OF_HOST_MEMORY;
goto out;
}
// Allocate the blacklist array
props->blacklist_layer_names = loader_instance_heap_alloc(
inst, sizeof(char[MAX_STRING_SIZE]) * props->num_blacklist_layers, VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE);
- if (props->blacklist_layer_names == NULL) {
+ if (props->blacklist_layer_names == NULL && props->num_blacklist_layers > 0) {
result = VK_ERROR_OUT_OF_HOST_MEMORY;
goto out;
}
// Allocate buffer for override paths
props->override_paths =
loader_instance_heap_alloc(inst, sizeof(char[MAX_STRING_SIZE]) * count, VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE);
- if (NULL == props->override_paths) {
+ if (NULL == props->override_paths && count > 0) {
result = VK_ERROR_OUT_OF_HOST_MEMORY;
goto out;
}
// We'll need to save the dl handles so we can close them later
loader_platform_dl_handle *libs = malloc(sizeof(loader_platform_dl_handle) * layers.count);
- if (libs == NULL) {
+ if (libs == NULL && layers.count > 0) {
return VK_ERROR_OUT_OF_HOST_MEMORY;
}
size_t lib_count = 0;
// We'll need to save the dl handles so we can close them later
loader_platform_dl_handle *libs = malloc(sizeof(loader_platform_dl_handle) * layers.count);
- if (libs == NULL) {
+ if (libs == NULL && layers.count > 0) {
return VK_ERROR_OUT_OF_HOST_MEMORY;
}
size_t lib_count = 0;
// We'll need to save the dl handles so we can close them later
loader_platform_dl_handle *libs = malloc(sizeof(loader_platform_dl_handle) * layers.count);
- if (libs == NULL) {
+ if (libs == NULL && layers.count > 0) {
return VK_ERROR_OUT_OF_HOST_MEMORY;
}
size_t lib_count = 0;