From 35eb251244ee360cedef6ec1143e65b59da604a8 Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Wed, 17 Oct 2012 14:20:18 +0100 Subject: Fix "error setting certificate verify locations" problem when the Choices file doesn't exist. Now there's a single place for front ends to set options overrides. Fix nsoption_setnull_charp leak. --- desktop/netsurf.c | 1 + desktop/options.h | 12 ++++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) (limited to 'desktop') diff --git a/desktop/netsurf.c b/desktop/netsurf.c index 65765fae4..0b1cffe0a 100644 --- a/desktop/netsurf.c +++ b/desktop/netsurf.c @@ -166,6 +166,7 @@ nserror netsurf_init(int *pargc, LOG(("Using '%s' for Options file", options)); nsoption_read(options); + gui_options_init_defaults(); messages_load(messages); diff --git a/desktop/options.h b/desktop/options.h index b96aaec52..53c025c18 100644 --- a/desktop/options.h +++ b/desktop/options.h @@ -114,13 +114,16 @@ extern struct ns_options nsoptions; } \ } while (0) -#define nsoption_setnull_charp(OPTION, VALUE) do { \ - if (nsoptions.OPTION == NULL) { \ +#define nsoption_setnull_charp(OPTION, VALUE) \ + do { \ + if (nsoptions.OPTION == NULL) { \ nsoptions.OPTION = VALUE; \ if (*nsoptions.OPTION == 0) { \ free(nsoptions.OPTION); \ nsoptions.OPTION = NULL; \ } \ + } else { \ + free(VALUE); \ } \ } while (0) @@ -175,5 +178,10 @@ int nsoption_snoptionf(char *string, size_t size, unsigned int option, */ void nsoption_commandline(int *pargc, char **argv); +/** + * Set default values for unset front-end specific options + */ +void gui_options_init_defaults(void); + #endif -- cgit v1.2.3