From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by arlo.cworth.org (Postfix) with ESMTP id EE4936DE0F5A for ; Thu, 9 May 2019 17:23:32 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Spam-Flag: NO X-Spam-Score: -0.035 X-Spam-Level: X-Spam-Status: No, score=-0.035 tagged_above=-999 required=5 tests=[AWL=-0.034, SPF_PASS=-0.001] autolearn=disabled Received: from arlo.cworth.org ([127.0.0.1]) by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 1VRc8gehXJG7 for ; Thu, 9 May 2019 17:23:32 -0700 (PDT) Received: from fethera.tethera.net (fethera.tethera.net [198.245.60.197]) by arlo.cworth.org (Postfix) with ESMTPS id D17066DE0F50 for ; Thu, 9 May 2019 17:23:31 -0700 (PDT) Received: from remotemail by fethera.tethera.net with local (Exim 4.89) (envelope-from ) id 1hOtJw-0000rP-Hj; Thu, 09 May 2019 20:23:28 -0400 Received: (nullmailer pid 31202 invoked by uid 1000); Fri, 10 May 2019 00:23:26 -0000 From: David Bremner To: notmuch@notmuchmail.org Subject: [PATCH] lib/message-file: close stream in destructor Date: Thu, 9 May 2019 21:23:24 -0300 Message-Id: <20190510002324.31140-1-david@tethera.net> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.29 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: Fri, 10 May 2019 00:23:33 -0000 Without this, $ make time-test OPTIONS=--small leads to fatal errors from too many open files. Thanks to st-gourichon-fid for bringing this problem to my attention in IRC. --- lib/message-file.c | 3 +++ 1 file changed, 3 insertions(+) The regression test could be improved, but I wanted to get a fix out and hopefully into master, as this is a problem that seems particularly likely to hit new users during their initial notmuch-new. diff --git a/lib/message-file.c b/lib/message-file.c index 50855067..24c5fda4 100644 --- a/lib/message-file.c +++ b/lib/message-file.c @@ -46,6 +46,9 @@ _notmuch_message_file_destructor (notmuch_message_file_t *message) if (message->message) g_object_unref (message->message); + if (message->stream) + g_object_unref (message->stream); + return 0; } -- 2.20.1