From: Vinson Lee Date: Fri, 23 Mar 2012 06:59:52 +0000 (-0700) Subject: mesa: Fix memory leak in _mesa_get_uniform_location. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=0f3aa9f4bd7daab354deb9268307c5628b460f6b;p=mesa.git mesa: Fix memory leak in _mesa_get_uniform_location. Fixes Coverity resource leak defect. NOTE: This is a candidate for the 8.0 branch. Signed-off-by: Vinson Lee Reviewed-by: José Fonseca Reviewed-by: Kenneth Graunke --- diff --git a/src/mesa/main/uniform_query.cpp b/src/mesa/main/uniform_query.cpp index 991df7896b4..da41ee84c9c 100644 --- a/src/mesa/main/uniform_query.cpp +++ b/src/mesa/main/uniform_query.cpp @@ -905,8 +905,10 @@ _mesa_get_uniform_location(struct gl_context *ctx, name_copy[i-1] = '\0'; offset = strtol(&name[i], NULL, 10); - if (offset < 0) + if (offset < 0) { + free(name_copy); return -1; + } array_lookup = true; } else {