From ac0445457c9662ee49807382add05548f1efcc9c Mon Sep 17 00:00:00 2001 From: int3 Date: Fri, 14 May 2010 17:30:00 +0800 Subject: [PATCH] Fix leak in State.pages --- zathura.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/zathura.c b/zathura.c index 3338fe0..77187cf 100644 --- a/zathura.c +++ b/zathura.c @@ -427,7 +427,7 @@ init_zathura() Zathura.Global.goto_mode = GOTO_MODE; Zathura.State.filename = (char*) DEFAULT_TEXT; - Zathura.State.pages = ""; + Zathura.State.pages = g_strdup_printf(""); Zathura.State.scroll_percentage = 0; Zathura.Marker.markers = NULL; @@ -966,6 +966,7 @@ update_status() if( Zathura.PDF.document && Zathura.PDF.pages ) { int page = Zathura.PDF.page_number; + g_free(Zathura.State.pages); /* if((Zathura.Global.goto_mode == GOTO_LABELS) && Zathura.PDF.pages[page]->label) Zathura.State.pages = g_strdup_printf("[%s/%i]", @@ -2171,8 +2172,9 @@ cmd_close(int argc, char** argv) /* reset values */ free(Zathura.PDF.pages); g_object_unref(Zathura.PDF.document); + g_free(Zathura.State.pages); - Zathura.State.pages = ""; + Zathura.State.pages = g_strdup_printf(""); Zathura.State.filename = (char*) DEFAULT_TEXT; g_static_mutex_lock(&(Zathura.Lock.pdf_obj_lock));