X-Git-Url: https://git.notmuchmail.org/git?p=notmuch;a=blobdiff_plain;f=lib%2Fquery.cc;h=59f4011b31d3a3f5616227d352b8f7234b05ee0f;hp=7e1b6b52984330d82f6c82462f64d02c2450f0f4;hb=f6cb896bc4c0bafca1acd5ac3fb45169cd893e29;hpb=8cbb5114a20c1217f23977fd5edca99a0b7a2955 diff --git a/lib/query.cc b/lib/query.cc index 7e1b6b52..59f4011b 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 @@ -247,6 +249,10 @@ notmuch_query_search_threads (notmuch_query_t *query) free, NULL); threads->messages = notmuch_query_search_messages (query); + if (threads->messages == NULL) { + talloc_free (threads); + return NULL; + } threads->thread_id = NULL;