From e0e423aacd8dc01eaa043a1c1aebd23e048288c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Date: Tue, 19 Jan 2016 00:58:15 +0100 Subject: [PATCH] renderer: avoid crash in vrend_destroy_shader_selector() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If we didn't run succesfully vrend_destroy_shader_selector(), sel->sinfo.so_names might be NULL. Fix found thanks to american fuzzy lop. Signed-off-by: Marc-André Lureau --- src/vrend_renderer.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/vrend_renderer.c b/src/vrend_renderer.c index fd5f96f..510285a 100644 --- a/src/vrend_renderer.c +++ b/src/vrend_renderer.c @@ -560,8 +560,9 @@ static void vrend_destroy_shader_selector(struct vrend_shader_selector *sel) vrend_shader_destroy(p); p = c; } - for (i = 0; i < sel->sinfo.so_info.num_outputs; i++) - free(sel->sinfo.so_names[i]); + if (sel->sinfo.so_names) + for (i = 0; i < sel->sinfo.so_info.num_outputs; i++) + free(sel->sinfo.so_names[i]); free(sel->tmp_buf); free(sel->sinfo.so_names); free(sel->sinfo.interpinfo);