Skip to content

Commit 2171cfa

Browse files
Free ICD "library_path" when it contains an empty string
If "library_path" contained nothing, loader_parse_json_string returns the string "", which still needs to be freed.
1 parent 938a53e commit 2171cfa

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

loader/loader.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3612,12 +3612,11 @@ VkResult loader_parse_icd_manifest(const struct loader_instance *inst, char *fil
36123612
"loader_parse_icd_manifest: Failed retrieving ICD JSON %s \'library_path\' field. Skipping ICD JSON.", file_str);
36133613
res = VK_ERROR_OUT_OF_HOST_MEMORY;
36143614
goto out;
3615-
}
3616-
3617-
if (!library_path || strlen(library_path) == 0) {
3615+
} else if (!library_path || strlen(library_path) == 0) {
36183616
loader_log(inst, VULKAN_LOADER_WARN_BIT | VULKAN_LOADER_DRIVER_BIT, 0,
36193617
"loader_parse_icd_manifest: ICD JSON %s \'library_path\' field is empty. Skipping ICD JSON.", file_str);
36203618
res = VK_ERROR_INCOMPATIBLE_DRIVER;
3619+
loader_instance_heap_free(inst, library_path);
36213620
goto out;
36223621
}
36233622

0 commit comments

Comments
 (0)