From 138fd38afe6c6d44179952dd17c4b07e9223ad37 Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Sat, 24 Apr 2010 07:25:12 -0700 Subject: lib: Ensure notmuch_query_search_messages returns NULL on an exception. Previously, this function may have segfaulted immediately after reporting the exception. --- lib/query.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'lib/query.cc') diff --git a/lib/query.cc b/lib/query.cc index 7e1b6b52..d241dc1d 100644 --- a/lib/query.cc +++ b/lib/query.cc @@ -163,14 +163,16 @@ notmuch_query_search_messages (notmuch_query_t *query) messages->iterator = mset.begin (); messages->iterator_end = mset.end (); + return &messages->base; + } catch (const Xapian::Error &error) { fprintf (stderr, "A Xapian exception occurred performing query: %s\n", error.get_msg().c_str()); fprintf (stderr, "Query string was: %s\n", query->query_string); notmuch->exception_reported = TRUE; + talloc_free (messages); + return NULL; } - - return &messages->base; } notmuch_bool_t -- cgit v1.2.3