Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 897A1431FDA for ; Sat, 17 Mar 2012 09:42:52 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: 0 X-Spam-Level: X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none] autolearn=disabled Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Tx5zwxqTc-n2 for ; Sat, 17 Mar 2012 09:42:50 -0700 (PDT) Received: from mail.cryptobitch.de (cryptobitch.de [88.198.7.68]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id DECAA431FC4 for ; Sat, 17 Mar 2012 09:42:47 -0700 (PDT) Received: from mail.jade-hamburg.de (unknown [85.183.11.228]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.cryptobitch.de (Postfix) with ESMTPSA id 46290329F52 for ; Sat, 17 Mar 2012 17:42:46 +0100 (CET) Received: by mail.jade-hamburg.de (Postfix, from userid 401) id BD178DF2A2; Sat, 17 Mar 2012 17:42:45 +0100 (CET) Received: from thinkbox.jade-hamburg.de (unknown [10.1.1.153]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: teythoon) by mail.jade-hamburg.de (Postfix) with ESMTPSA id B733EDF2A1; Sat, 17 Mar 2012 17:42:40 +0100 (CET) Received: from teythoon by thinkbox.jade-hamburg.de with local (Exim 4.77) (envelope-from ) id 1S8whF-0008Ru-2b; Sat, 17 Mar 2012 17:41:37 +0100 From: Justus Winter <4winter@informatik.uni-hamburg.de> To: notmuch@notmuchmail.org Subject: [PATCH] Fix error reporting in notmuch_database_find_message_by_filename Date: Sat, 17 Mar 2012 17:41:27 +0100 Message-Id: <1332002487-32411-2-git-send-email-4winter@informatik.uni-hamburg.de> X-Mailer: git-send-email 1.7.9.1 In-Reply-To: <1332002487-32411-1-git-send-email-4winter@informatik.uni-hamburg.de> References: <1332002487-32411-1-git-send-email-4winter@informatik.uni-hamburg.de> X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 17 Mar 2012 16:42:53 -0000 Formerly it was possible for *message_ret to be left uninitialized. The documentation however clearly states that "[o]n any failure or when the message is not found, this function initializes '*message' to NULL". Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de> --- lib/database.cc | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/lib/database.cc b/lib/database.cc index 8f8df1a..16c4354 100644 --- a/lib/database.cc +++ b/lib/database.cc @@ -1825,6 +1825,9 @@ notmuch_database_find_message_by_filename (notmuch_database_t *notmuch, if (message_ret == NULL) return NOTMUCH_STATUS_NULL_POINTER; + /* return NULL on any failure */ + *message_ret = NULL; + local = talloc_new (notmuch); try { -- 1.7.9.1