From: Carl Worth Date: Mon, 20 Sep 2010 22:01:52 +0000 (+0000) Subject: lib: Fix use-after-free bug. X-Git-Tag: 0.4~85 X-Git-Url: https://git.notmuchmail.org/git?p=notmuch;a=commitdiff_plain;h=029830c1f130b3780684d056c01a73061090f15f lib: Fix use-after-free bug. 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). --- diff --git a/lib/database.cc b/lib/database.cc index 6affc205..e4ac970f 100644 --- a/lib/database.cc +++ b/lib/database.cc @@ -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