intel/tools: fix potential memory leaks

CID: 1444041
CID: 1444104

Signed-off-by: Marcin Ślusarz <marcin.slusarz@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11574>
This commit is contained in:
Marcin Ślusarz
2021-06-24 13:40:11 +02:00
committed by Marge Bot
parent 14227b3364
commit 5c5423e6ee
+3
View File
@@ -459,6 +459,9 @@ maybe_init(int fd)
fail_if(device == -1, "Unknown platform '%s'\n", value);
device_override = true;
} else if (!strcmp(key, "file")) {
free(output_filename);
if (output_file)
fclose(output_file);
output_filename = strdup(value);
output_file = fopen(output_filename, "w+");
fail_if(output_file == NULL,