From 7f38470a9e080d10e969bda4daa6d8e5dd3f26dd Mon Sep 17 00:00:00 2001 From: Sebastian Ramacher Date: Fri, 13 Nov 2015 00:29:35 +0100 Subject: [PATCH] Fix another invalid free Signed-off-by: Sebastian Ramacher --- zathura/zathura.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/zathura/zathura.c b/zathura/zathura.c index db883a8..669dc5f 100644 --- a/zathura/zathura.c +++ b/zathura/zathura.c @@ -665,14 +665,13 @@ document_open(zathura_t* zathura, const char* path, const char* password, } /* read history file */ - char first_page_column_list_default[] = "1:2"; zathura_fileinfo_t file_info = { .current_page = 0, .page_offset = 0, .scale = 1, .rotation = 0, .pages_per_row = 0, - .first_page_column_list = first_page_column_list_default, + .first_page_column_list = NULL, .position_x = 0, .position_y = 0 }; @@ -870,7 +869,7 @@ document_open(zathura_t* zathura, const char* path, const char* password, /* view mode */ unsigned int pages_per_row = 1; - char* first_page_column_list = first_page_column_list_default; + char* first_page_column_list = NULL; unsigned int page_padding = 1; girara_setting_get(zathura->ui.session, "page-padding", &page_padding); @@ -882,8 +881,9 @@ document_open(zathura_t* zathura, const char* path, const char* password, } /* read first_page_column list */ - if (strcmp(file_info.first_page_column_list, "")) { + if (file_info.first_page_column_list != NULL && strcmp(file_info.first_page_column_list, "")) { first_page_column_list = file_info.first_page_column_list; + file_info.first_page_column_list = NULL; } else { girara_setting_get(zathura->ui.session, "first-page-column", &first_page_column_list); } @@ -893,6 +893,7 @@ document_open(zathura_t* zathura, const char* path, const char* password, girara_setting_set(zathura->ui.session, "pages-per-row", &pages_per_row); girara_setting_set(zathura->ui.session, "first-page-column", first_page_column_list); + g_free(file_info.first_page_column_list); g_free(first_page_column_list); page_widget_set_mode(zathura, page_padding, pages_per_row, first_page_column);