[PATCH] lib: fix memory leak of field processor objects
authorDavid Bremner <david@tethera.net>
Fri, 10 Jun 2016 02:37:48 +0000 (23:37 +2100)
committerW. Trevor King <wking@tremily.us>
Sat, 20 Aug 2016 23:22:02 +0000 (16:22 -0700)
59/1430d1c1310c637fa083f75fb75f40577e803e [new file with mode: 0644]

diff --git a/59/1430d1c1310c637fa083f75fb75f40577e803e b/59/1430d1c1310c637fa083f75fb75f40577e803e
new file mode 100644 (file)
index 0000000..4a03ead
--- /dev/null
@@ -0,0 +1,72 @@
+Return-Path: <bremner@tethera.net>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by arlo.cworth.org (Postfix) with ESMTP id 53CCA6DE0222\r
+ for <notmuch@notmuchmail.org>; Thu,  9 Jun 2016 19:38:07 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at cworth.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.011\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.011 tagged_above=-999 required=5\r
+ tests=[AWL=-0.000, SPF_PASS=-0.001, T_RP_MATCHES_RCVD=-0.01]\r
+ autolearn=disabled\r
+Received: from arlo.cworth.org ([127.0.0.1])\r
+ by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id kaR8unsRkMWl for <notmuch@notmuchmail.org>;\r
+ Thu,  9 Jun 2016 19:37:59 -0700 (PDT)\r
+Received: from fethera.tethera.net (fethera.tethera.net [198.245.60.197])\r
+ by arlo.cworth.org (Postfix) with ESMTPS id 9B7156DE01C2\r
+ for <notmuch@notmuchmail.org>; Thu,  9 Jun 2016 19:37:59 -0700 (PDT)\r
+Received: from remotemail by fethera.tethera.net with local (Exim 4.84)\r
+ (envelope-from <bremner@tethera.net>)\r
+ id 1bBCKQ-00039l-3S; Thu, 09 Jun 2016 22:37:46 -0400\r
+Received: (nullmailer pid 9565 invoked by uid 1000);\r
+ Fri, 10 Jun 2016 02:37:55 -0000\r
+From: David Bremner <david@tethera.net>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH] lib: fix memory leak of field processor objects\r
+Date: Thu,  9 Jun 2016 23:37:48 -0300\r
+Message-Id: <1465526268-9522-1-git-send-email-david@tethera.net>\r
+X-Mailer: git-send-email 2.8.1\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.20\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+ <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <https://notmuchmail.org/mailman/options/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch/>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <https://notmuchmail.org/mailman/listinfo/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Fri, 10 Jun 2016 02:38:07 -0000\r
+\r
+The field processor objects need to be deallocated explicitly just like\r
+the range processors (or a talloc destructor defined).\r
+---\r
+ lib/database.cc | 7 +++++++\r
+ 1 file changed, 7 insertions(+)\r
+\r
+diff --git a/lib/database.cc b/lib/database.cc\r
+index 2b2d821..afafe88 100644\r
+--- a/lib/database.cc\r
++++ b/lib/database.cc\r
+@@ -1107,6 +1107,13 @@ notmuch_database_close (notmuch_database_t *notmuch)\r
+     delete notmuch->last_mod_range_processor;\r
+     notmuch->last_mod_range_processor = NULL;\r
\r
++#if HAVE_XAPIAN_FIELD_PROCESSOR\r
++    delete notmuch->date_field_processor;\r
++    notmuch->date_field_processor = NULL;\r
++    delete notmuch->query_field_processor;\r
++    notmuch->query_field_processor = NULL;\r
++#endif\r
++\r
+     return status;\r
+ }\r
\r
+-- \r
+2.8.1\r
+\r