Make sure we don't pass garbage to g_mutex_free()

Signed-off-by: Pavel Borzenkov <pavel.borzenkov@gmail.com>
Signed-off-by: Sebastian Ramacher <s.ramacher@gmx.at>
This commit is contained in:
Pavel Borzenkov 2011-10-19 07:55:50 -04:00 committed by Sebastian Ramacher
parent 8608823613
commit 9dd8067873

View file

@ -47,16 +47,9 @@ render_job(void* data)
render_thread_t* render_thread_t*
render_init(zathura_t* zathura) render_init(zathura_t* zathura)
{ {
render_thread_t* render_thread = malloc(sizeof(render_thread_t)); render_thread_t* render_thread = g_malloc0(sizeof(render_thread_t));
if (!render_thread) {
goto error_ret;
}
/* init */ /* init */
render_thread->list = NULL;
render_thread->thread = NULL;
render_thread->cond = NULL;
render_thread->zathura = zathura; render_thread->zathura = zathura;
/* setup */ /* setup */
@ -100,9 +93,7 @@ error_free:
g_mutex_free(render_thread->lock); g_mutex_free(render_thread->lock);
} }
free(render_thread); g_free(render_thread);
error_ret:
return NULL; return NULL;
} }