From: Kenneth Graunke Date: Wed, 29 Jan 2020 15:50:16 +0000 (-0800) Subject: loader: Fix leak of kernel driver name X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=594cb3035615b3a6cf3dc09ccee30554b56eb2f3;p=mesa.git loader: Fix leak of kernel driver name This is strdup'd, it needs to be freed. CID: 1458032 Fixes: f93bb2fb102 ("loader: Check if the kernel driver is i915 before loading iris") Reviewed-by: Eric Engestrom Reviewed-by: Sagar Ghuge Tested-by: Marge Bot Part-of: --- diff --git a/src/loader/loader.c b/src/loader/loader.c index a2fe0a241a2..c896fdc3360 100644 --- a/src/loader/loader.c +++ b/src/loader/loader.c @@ -118,7 +118,10 @@ bool is_kernel_i915(int fd) { char *kernel_driver = loader_get_kernel_driver_name(fd); - return kernel_driver && strcmp(kernel_driver, "i915") == 0; + bool is_i915 = kernel_driver && strcmp(kernel_driver, "i915") == 0; + + free(kernel_driver); + return is_i915; } #if defined(HAVE_LIBDRM)