From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id B8BA8431FAF for ; Sat, 17 Mar 2012 10:26:35 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -0.7 X-Spam-Level: X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5 tests=[RCVD_IN_DNSWL_LOW=-0.7] 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 t2K5Ez6kXOPK for ; Sat, 17 Mar 2012 10:26:35 -0700 (PDT) Received: from dmz-mailsec-scanner-3.mit.edu (DMZ-MAILSEC-SCANNER-3.MIT.EDU [18.9.25.14]) by olra.theworths.org (Postfix) with ESMTP id 1E496431FAE for ; Sat, 17 Mar 2012 10:26:35 -0700 (PDT) X-AuditID: 1209190e-b7f7c6d0000008c3-e2-4f64c94a553a Received: from mailhub-auth-1.mit.edu ( [18.9.21.35]) by dmz-mailsec-scanner-3.mit.edu (Symantec Messaging Gateway) with SMTP id E2.56.02243.A49C46F4; Sat, 17 Mar 2012 13:26:34 -0400 (EDT) Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103]) by mailhub-auth-1.mit.edu (8.13.8/8.9.2) with ESMTP id q2HHQYPC016490; Sat, 17 Mar 2012 13:26:34 -0400 Received: from awakening.csail.mit.edu (awakening.csail.mit.edu [18.26.4.91]) (authenticated bits=0) (User authenticated as amdragon@ATHENA.MIT.EDU) by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id q2HHQWa9017090 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT); Sat, 17 Mar 2012 13:26:33 -0400 (EDT) Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.77) (envelope-from ) id 1S8xOi-0004FQ-FF; Sat, 17 Mar 2012 13:26:32 -0400 Date: Sat, 17 Mar 2012 13:26:32 -0400 From: Austin Clements To: Justus Winter <4winter@informatik.uni-hamburg.de> Subject: Re: [PATCH] Fix error reporting in notmuch_database_find_message_by_filename Message-ID: <20120317172632.GM2670@mit.edu> References: <1332002487-32411-1-git-send-email-4winter@informatik.uni-hamburg.de> <1332002487-32411-2-git-send-email-4winter@informatik.uni-hamburg.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1332002487-32411-2-git-send-email-4winter@informatik.uni-hamburg.de> User-Agent: Mutt/1.5.21 (2010-09-15) X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmpmleLIzCtJLcpLzFFi42IR4hRV1vU6meJvMPOAjsXs1h9MFtdvzmR2 YPKYeP40m8ezVbeYA5iiuGxSUnMyy1KL9O0SuDJ+fnjCWrCBs+LDqTmMDYyb2bsYOTkkBEwk /h6/xAhhi0lcuLeeDcQWEtjHKLFsW0oXIxeQvYFR4v66P+wQzkkmiQlTOhghnCWMEp0P57KC tLAIqEpceHyPGcRmE9CQ2LZ/OdhYEQFTiQ0PHoCtYxaQlvj2u5kJxBYWCJfomX4XaB0HB6+A tsS0N74QM2cySuy+fxSsnldAUOLkzCcsEL1aEjf+vWQCqQeZs/wfB0iYUyBIouXcZ7C1ogIq ElNObmObwCg0C0n3LCTdsxC6FzAyr2KUTcmt0s1NzMwpTk3WLU5OzMtLLdI11svNLNFLTSnd xAgOa0m+HYxfDyodYhTgYFTi4eWYkOwvxJpYVlyZe4hRkoNJSZSX8UCKvxBfUn5KZUZicUZ8 UWlOavEhRgkOZiURXqnlQDnelMTKqtSifJiUNAeLkjivmtY7PyGB9MSS1OzU1ILUIpisDAeH kgTvoRNAjYJFqempFWmZOSUIaSYOTpDhPEDDt4PU8BYXJOYWZ6ZD5E8xKkqJ824ASQiAJDJK 8+B6YWnnFaM40CvCvNdBqniAKQuu+xXQYCagwTPLkkEGlyQipKQaGA0N+l8LGz94dvPMzo1x nNPT1jleu2H4dM6y6VUxRfFhc33mfJN91rSMeZp6r+C281uesh7feqfF3E/kVZHe/aX/LWMF lnuzMk1fkHbD9OWlnqkKfEoOdu/uqj/r4X9/clnslbPrjpRc3M1xkbn95r6nqp8+sBom7JxW bK9x+MO/rP0zLFx4rsgosRRnJBpqMRcVJwIAG6DQYBYDAAA= Cc: notmuch@notmuchmail.org 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 17:26:35 -0000 Quoth Justus Winter on Mar 17 at 5:41 pm: > 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> > --- Good catch. Actually, it looks like the error handling path in this function was completely bogus without this, since it checks if *message_ret is non-NULL and destroys it if so, even though the function may not have been the one to set it to NULL (and it may have been uninitialized in the caller). So, LGTM. > 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 {