Skip to content

Commit

Permalink
Properly initialize GError with NULL
Browse files Browse the repository at this point in the history
ref: https://bugzilla.redhat.com/show_bug.cgi?id=1357213

When g_key_file_load_from_file(... , &error) fails,
the error contents is supposed to be set to error.
However actually reading g_key_file_load_from_file()
implementation shows that unless error is initialized to
NULL before calling g_key_file_load_from_file(), the
function leaves error unchanged.
So afterwards, g_error_free(error) tries to free uninitialized
pointer, which causes SIGABRT.
  • Loading branch information
mtasaka authored and paulolieuthier committed Oct 16, 2016
1 parent bfbd882 commit a1b16b6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/base/fm-templates.c
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ static void _fm_template_update_from_file(FmTemplate *templ, FmTemplateFile *fil
GKeyFile *kf = g_key_file_new();
char *filename = fm_path_to_str(file->path);
char *tmp;
GError *error;
GError *error = NULL;
gboolean hidden;

if(g_key_file_load_from_file(kf, filename, G_KEY_FILE_NONE, &error))
Expand Down

0 comments on commit a1b16b6

Please sign in to comment.