aboutsummaryrefslogtreecommitdiff
path: root/database.cc
diff options
context:
space:
mode:
authorCarl Worth <cworth@cworth.org>2009-10-20 13:05:45 -0700
committerCarl Worth <cworth@cworth.org>2009-10-20 13:05:45 -0700
commit5a84df0f1507753b1776636ad268d36b7346a8fd (patch)
tree8427b873e91f2df3a744971d6ad9d6a9e5000c31 /database.cc
parente6236b88fd18231d0524b14723e0709a90b0572c (diff)
add_message: Fix memory leak of thread_ids GPtrArray.
We were properly feeing this memory when the thread-ids list was not empty, but leaking it when it was. Thanks, of course, to valgrind along with the G_SLICE=always-malloc environment variable which makes leak checking with glib almost bearable.
Diffstat (limited to 'database.cc')
-rw-r--r--database.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/database.cc b/database.cc
index abae5820..59e83736 100644
--- a/database.cc
+++ b/database.cc
@@ -577,7 +577,6 @@ notmuch_database_add_message (notmuch_database_t *notmuch,
free (id);
}
- g_ptr_array_free (thread_ids, TRUE);
doc.add_value (NOTMUCH_VALUE_THREAD, thread_id->str);
g_string_free (thread_id, TRUE);
} else if (message_id) {
@@ -589,6 +588,8 @@ notmuch_database_add_message (notmuch_database_t *notmuch,
doc.add_value (NOTMUCH_VALUE_THREAD, thread_id.str);
}
+ g_ptr_array_free (thread_ids, TRUE);
+
free (message_id);
date = notmuch_message_get_header (message, "date");