From 0f3aa9f4bd7daab354deb9268307c5628b460f6b Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Thu, 22 Mar 2012 23:59:52 -0700 Subject: mesa: Fix memory leak in _mesa_get_uniform_location. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- src/mesa/main/uniform_query.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/mesa/main') 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 { -- cgit v1.2.3