From 9dd8067873eb417a023acc215ae4b10a96203b59 Mon Sep 17 00:00:00 2001 From: Pavel Borzenkov Date: Wed, 19 Oct 2011 07:55:50 -0400 Subject: [PATCH] Make sure we don't pass garbage to g_mutex_free() Signed-off-by: Pavel Borzenkov Signed-off-by: Sebastian Ramacher --- render.c | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/render.c b/render.c index 155654b..fcb2ca4 100644 --- a/render.c +++ b/render.c @@ -47,16 +47,9 @@ render_job(void* data) render_thread_t* render_init(zathura_t* zathura) { - render_thread_t* render_thread = malloc(sizeof(render_thread_t)); - - if (!render_thread) { - goto error_ret; - } + render_thread_t* render_thread = g_malloc0(sizeof(render_thread_t)); /* init */ - render_thread->list = NULL; - render_thread->thread = NULL; - render_thread->cond = NULL; render_thread->zathura = zathura; /* setup */ @@ -100,9 +93,7 @@ error_free: g_mutex_free(render_thread->lock); } - free(render_thread); - -error_ret: + g_free(render_thread); return NULL; }