]> git.notmuchmail.org Git - notmuch/commitdiff
lib: Fix use-after-free bug.
authorCarl Worth <cworth@cworth.org>
Mon, 20 Sep 2010 22:01:52 +0000 (22:01 +0000)
committerCarl Worth <cworth@cworth.org>
Mon, 20 Sep 2010 22:01:52 +0000 (22:01 +0000)
Thanks to the new git-based test suite, it's easy to run the whole
test suite in valgrind, (simply "make test OPTIONS="--valgrind"), and
doing so showed this obvious use-after-free bug, (triggered by the
thread-order tests).

lib/database.cc

index 6affc205e4e81b894443722b30f54457ff7669e3..e4ac970f4bc597398750a60ca0988e59c6c700c1 100644 (file)
@@ -1300,7 +1300,7 @@ _resolve_message_id_to_thread_id (notmuch_database_t *notmuch,
 
     talloc_free (metadata_key);
 
-    return thread_id;
+    return talloc_strdup (ctx, thread_id);
 }
 
 static notmuch_status_t