From cfc0c2aa7d9a9c637dc7e7d683578ccac3611a6d Mon Sep 17 00:00:00 2001 From: Moritz Lipp Date: Tue, 20 Jan 2015 21:37:04 +0100 Subject: [PATCH] Don't free content_type before setting error message --- zathura/document.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/zathura/document.c b/zathura/document.c index 29781b6..8fed1a3 100644 --- a/zathura/document.c +++ b/zathura/document.c @@ -94,15 +94,20 @@ zathura_document_open(zathura_plugin_manager_t* plugin_manager, const char* } plugin = zathura_plugin_manager_get_plugin(plugin_manager, content_type); - g_free((void*)content_type); - content_type = NULL; if (plugin == NULL) { girara_error("Unknown file type: '%s'", content_type); check_set_error(error, ZATHURA_ERROR_UNKNOWN); + + g_free((void*)content_type); + content_type = NULL; + goto error_free; } + g_free((void*)content_type); + content_type = NULL; + document = g_try_malloc0(sizeof(zathura_document_t)); if (document == NULL) { check_set_error(error, ZATHURA_ERROR_OUT_OF_MEMORY);