Fix memory leak in scanner

This commit is contained in:
Markus Koch 2018-07-07 09:35:38 +02:00
parent 843329331d
commit 8678f326cd

View File

@ -325,7 +325,7 @@ static void mdiary_add_file_to_store(struct mdiary_scanner *mdiary_scanner,
} }
if (!tagList) { if (!tagList) {
g_warning("PARSER: Could not detect tags in file!\n"); g_warning("PARSER: Could not detect tags in file!\n");
tagList = g_list_append(tagList, "untagged"); tagList = g_list_append(tagList, g_strdup("untagged"));
} }
if (!text) { if (!text) {
g_warning("PARSER: Could not find any text in file!\n"); g_warning("PARSER: Could not find any text in file!\n");
@ -366,6 +366,8 @@ static void mdiary_add_file_to_store(struct mdiary_scanner *mdiary_scanner,
g_input_stream_close(G_INPUT_STREAM(stream), NULL, NULL); g_input_stream_close(G_INPUT_STREAM(stream), NULL, NULL);
g_object_unref(file); g_object_unref(file);
} }
g_list_free_full(tagList, *g_free);
g_string_free(text, 0); g_string_free(text, 0);
g_free(summary); g_free(summary);
g_free(title); g_free(title);