diff options
author | Carl Worth <cworth@cworth.org> | 2010-04-24 07:25:12 -0700 |
---|---|---|
committer | Carl Worth <cworth@cworth.org> | 2010-04-24 07:27:50 -0700 |
commit | 138fd38afe6c6d44179952dd17c4b07e9223ad37 (patch) | |
tree | d972839e6578e4170b2503995c923b94657e7eac /lib/query.cc | |
parent | e3e0e26806cf95cddd4dfb11c24d1ecd15171110 (diff) |
lib: Ensure notmuch_query_search_messages returns NULL on an exception.
Previously, this function may have segfaulted immediately after
reporting the exception.
Diffstat (limited to 'lib/query.cc')
-rw-r--r-- | lib/query.cc | 6 |
1 files changed, 4 insertions, 2 deletions
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 |