mirror of
https://git.pwmt.org/pwmt/zathura.git
synced 2025-01-30 02:34:56 +01:00
Saner solution for the possible seg fault
This commit is contained in:
parent
9d5cbcabb5
commit
2a90a68ce8
1 changed files with 15 additions and 16 deletions
31
zathura.c
31
zathura.c
|
@ -25,20 +25,6 @@ gboolean document_info_open(gpointer data);
|
|||
zathura_t*
|
||||
zathura_init(int argc, char* argv[])
|
||||
{
|
||||
zathura_t* zathura = malloc(sizeof(zathura_t));
|
||||
|
||||
if (zathura == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* general */
|
||||
zathura->document = NULL;
|
||||
|
||||
/* plugins */
|
||||
zathura->plugins.plugins = girara_list_new();
|
||||
zathura->plugins.path = girara_list_new();
|
||||
girara_list_set_free_function(zathura->plugins.path, g_free);
|
||||
|
||||
/* parse command line options */
|
||||
GdkNativeWindow embed = 0;
|
||||
gchar* config_dir = NULL, *data_dir = NULL, *plugin_path = NULL;
|
||||
|
@ -60,11 +46,24 @@ zathura_init(int argc, char* argv[])
|
|||
printf("Error parsing command line arguments: %s\n", error->message);
|
||||
g_option_context_free(context);
|
||||
g_error_free(error);
|
||||
free(zathura);
|
||||
return NULL;
|
||||
goto error_free;
|
||||
}
|
||||
g_option_context_free(context);
|
||||
|
||||
zathura_t* zathura = malloc(sizeof(zathura_t));
|
||||
|
||||
if (zathura == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* general */
|
||||
zathura->document = NULL;
|
||||
|
||||
/* plugins */
|
||||
zathura->plugins.plugins = girara_list_new();
|
||||
zathura->plugins.path = girara_list_new();
|
||||
girara_list_set_free_function(zathura->plugins.path, g_free);
|
||||
|
||||
if (config_dir) {
|
||||
zathura->config.config_dir = g_strdup(config_dir);
|
||||
} else {
|
||||
|
|
Loading…
Reference in a new issue