[PATCH] Fixing possible dereferencing of NULL pointer

Dirk Hohndel hohndel at infradead.org
Mon Apr 12 10:45:40 PDT 2010


I must have misunderstood the cases in which this function can be called
It seemed odd to try to manage authors when author==NULL, but that's
what we appear to be doing; so now we check that autho != NULL and bail
otherwise.

Signed-off-by: Dirk Hohndel <hohndel at infradead.org>
---
 lib/thread.cc |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/lib/thread.cc b/lib/thread.cc
index c3c83a3..93a7264 100644
--- a/lib/thread.cc
+++ b/lib/thread.cc
@@ -88,7 +88,7 @@ _thread_move_matched_author (notmuch_thread_t *thread,
     char *currentauthor;
     int idx,nmstart,author_len,authors_len;
 
-    if (thread->authors == NULL)
+    if (thread->authors == NULL || author == NULL)
 	return;
     if (thread->nonmatched_authors == NULL)
 	thread->nonmatched_authors = thread->authors;
-- 
1.6.6.1


-- 
Dirk Hohndel
Intel Open Source Technology Center


More information about the notmuch mailing list