From aee033c1c4388fc6a455d9b636ce20e5111d494d Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Tue, 22 Dec 2015 09:04:19 +1000 Subject: [PATCH] renderer: don't free tmp_buf if shader create fails. Noticed by Marc-Andre. --- src/vrend_renderer.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/vrend_renderer.c b/src/vrend_renderer.c index e584a36..0d3298f 100644 --- a/src/vrend_renderer.c +++ b/src/vrend_renderer.c @@ -2169,9 +2169,12 @@ int vrend_create_shader(struct vrend_context *ctx, if (!tgsi_text_translate((const char *)shd_text, tokens, num_tokens + 10)) return EINVAL; - vrend_finish_shader(ctx, sel, tokens); - free(sel->tmp_buf); - sel->tmp_buf = NULL; + if (vrend_finish_shader(ctx, sel, tokens)) + new_shader = false; + else { + free(sel->tmp_buf); + sel->tmp_buf = NULL; + } free(tokens); ctx->sub->long_shader_in_progress_handle[type] = 0; }