g_free return values of girara_setting_get

This commit is contained in:
Sebastian Ramacher 2011-10-21 15:32:50 +02:00
parent 2572c2a5cc
commit 7a5dd056fd
3 changed files with 13 additions and 7 deletions

View File

@ -15,6 +15,7 @@ config_load_default(zathura_t* zathura)
}
int int_value = 0;
float float_value = 0;
char* string_value = NULL;
girara_session_t* gsession = zathura->ui.session;
@ -33,11 +34,14 @@ config_load_default(zathura_t* zathura)
/* zathura settings */
int_value = 10;
girara_setting_add(gsession, "zoom-step", &int_value, INT, false, "Zoom step", NULL, NULL);
girara_setting_add(gsession, "zoom-step", &int_value, INT, false, "Zoom step", NULL, NULL);
int_value = 1;
girara_setting_add(gsession, "page-padding", &int_value, INT, true, "Padding between pages", NULL, NULL);
girara_setting_add(gsession, "page-padding", &int_value, INT, true, "Padding between pages", NULL, NULL);
int_value = 2;
girara_setting_add(gsession, "pages-per-row", &int_value, INT, false, "Number of pages per row", cb_pages_per_row_value_changed, zathura);
girara_setting_add(gsession, "pages-per-row", &int_value, INT, false, "Number of pages per row", cb_pages_per_row_value_changed, zathura);
float_value = 40;
girara_setting_add(gsession, "scroll-step", &float_value, FLOAT, false, "Scroll step", NULL, NULL);
string_value = "#FFFFFF";
girara_setting_add(gsession, "recolor-dark-color", string_value, STRING, false, "Recoloring (dark color)", NULL, NULL);

View File

@ -77,7 +77,7 @@ sc_adjust_window(girara_session_t* session, girara_argument_t* argument,
error_free:
/* cleanup */
free(pages_per_row);
g_free(pages_per_row);
error_ret:
@ -522,6 +522,7 @@ sc_zoom(girara_session_t* session, girara_argument_t* argument, unsigned int
}
float zoom_step = *value / 100.0f;
g_free(value);
if (argument->n == ZOOM_IN) {
zathura->document->scale += zoom_step;

View File

@ -184,6 +184,7 @@ zathura_init(int argc, char* argv[])
/* save page padding */
int* page_padding = girara_setting_get(zathura->ui.session, "page-padding");
zathura->global.page_padding = (page_padding) ? *page_padding : 1;
g_free(page_padding);
gtk_table_set_row_spacings(GTK_TABLE(zathura->ui.page_view), zathura->global.page_padding);
gtk_table_set_col_spacings(GTK_TABLE(zathura->ui.page_view), zathura->global.page_padding);
@ -192,13 +193,13 @@ zathura_init(int argc, char* argv[])
char* string_value = girara_setting_get(zathura->ui.session, "recolor-dark-color");
if (string_value != NULL) {
gdk_color_parse(string_value, &(zathura->ui.colors.recolor_dark_color));
free(string_value);
g_free(string_value);
}
string_value = girara_setting_get(zathura->ui.session, "recolor-light-color");
if (string_value != NULL) {
gdk_color_parse(string_value, &(zathura->ui.colors.recolor_light_color));
free(string_value);
g_free(string_value);
}
/* database */
@ -381,7 +382,7 @@ document_open(zathura_t* zathura, const char* path, const char* password)
/* view mode */
int* value = girara_setting_get(zathura->ui.session, "pages-per-row");
int pages_per_row = (value) ? *value : 1;
free(value);
g_free(value);
page_view_set_mode(zathura, pages_per_row);
girara_set_view(zathura->ui.session, zathura->ui.page_view);