--- /dev/null
+Return-Path: <glasse@cs.rpi.edu>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by olra.theworths.org (Postfix) with ESMTP id 89659431FAF\r
+ for <notmuch@notmuchmail.org>; Mon, 6 Feb 2012 14:03:41 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.54\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.54 tagged_above=-999 required=5\r
+ tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
+ RCVD_IN_BL_SPAMCOP_NET=1.246, RCVD_IN_DNSWL_MED=-2.3,\r
+ RCVD_IN_SORBS_WEB=0.614] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+ by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id yzxeCoz-IYrM for <notmuch@notmuchmail.org>;\r
+ Mon, 6 Feb 2012 14:03:34 -0800 (PST)\r
+Received: from cliffclavin.cs.rpi.edu (cliffclavin.cs.rpi.edu\r
+ [128.113.126.25]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))\r
+ (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS\r
+ id 6301A431FAE for <notmuch@notmuchmail.org>; Mon, 6 Feb 2012 14:03:34 -0800\r
+ (PST)\r
+X-Hash:\r
+ S|87554d9768bab8a4ccc4379bb721ab9fd9e7450b|8e3fb853444f45e635c0d8a16b0e28ee\r
+X-Countries: Cameroon, United States\r
+X-SMTP-From: accepted <glasse@cs.rpi.edu> [195.24.209.22] [195.24.209.22]\r
+ (localhost) {Cameroon}\r
+DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=cs.rpi.edu; h=from\r
+ :to:cc:subject:date:message-id; s=default; i=glasse@cs.rpi.edu;\r
+ t=1328565812; x=1329170612; l=1091; bh=uSo3tBW0aK3WJQQVKhpr4qpF\r
+ VBY=; b=Ejx77AwPL7XW4mkdIl6aU+Ro8yziNpjbIe1DExZC9biSASWXqgZFjgAI\r
+ WTOhHnqdw65rxkAXdiWMdpu+uW/4aJaBdW+Fw1bsxwUbN917/cLBvsqtGyDOES2M\r
+ 9iIOrjq1bSMZdbtU1rclfJZW9GUTDsmELC3hA1lKjWDnON0pz1E=\r
+DomainKey-Signature: a=rsa-sha1; c=nofws; d=cs.rpi.edu; h=from:to:cc\r
+ :subject:date:message-id; q=dns; s=default; b=XRgRNfMyh1see/P6b+\r
+ jtPi3vcxVfvF6dE/BysPB0fGyLA+XOF66A0oTdg82H0YtdWJhC1tQmS0eDDfsJxr\r
+ 1rpj3Ije/+80PLF1Vis0RuRQ7KjpEEk6c1EtjjeofZd2JTPf27MCkdc2T8J8tIr/\r
+ XEJvfcrQyBQTmgUL5WxHhzzXc=\r
+X-Spam-Info: -2.7; ALL_TRUSTED,AWL,BAYES_00\r
+X-Spam-Scanned-By: cliffclavin.cs.rpi.edu using SpamAssassin 3.2.5 (hard limit\r
+ 15)\r
+Authentication-Results: cliffclavin.cs.rpi.edu;\r
+ DKIM=neutral (none) header.from=glasse@cs.rpi.edu;\r
+ SPF=neutral (mfrom;\r
+ Mechanism '?all' matched) smtp.mail=glasse@cs.rpi.edu\r
+X-Auth-Passed: cliffclavin.cs.rpi.edu:q16M38mA069463 Auth:glasse\r
+X-Virus-Scanned-By: cliffclavin.cs.rpi.edu\r
+Received: from localhost ([195.24.209.22]) (authenticated bits=0)\r
+ by cliffclavin.cs.rpi.edu (8.14.3/8.14.3) with ESMTP id q16M38mA069463\r
+ (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO);\r
+ Mon, 6 Feb 2012 17:03:24 -0500 (EST)\r
+ (envelope-from glasse@cs.rpi.edu)\r
+From: Ethan Glasser-Camp <glasse@cs.rpi.edu>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH] Free the results of scandir()\r
+Date: Mon, 6 Feb 2012 17:02:49 -0500\r
+Message-Id: <1328565769-29414-1-git-send-email-glasse@cs.rpi.edu>\r
+X-Mailer: git-send-email 1.7.5.4\r
+X-Scanned-By: MIMEDefang 2.67 on 128.113.126.25\r
+Cc: Ethan Glasser-Camp <ethan@betacantrips.com>\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+ <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://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: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Mon, 06 Feb 2012 22:03:41 -0000\r
+\r
+From: Ethan Glasser-Camp <ethan@betacantrips.com>\r
+\r
+scandir() returns "strings allocated via malloc(3)" which are then\r
+"collected in array namelist which is allocated via\r
+malloc(3)". Currently we just free the array namelist. Instead, free\r
+all the entries of namelist, and then free namelist.\r
+\r
+entry only points to elements of namelist, so we don't free it\r
+separately.\r
+---\r
+\r
+This should fix a minor memory leak in notmuch-new. Please confirm I'm\r
+reading the manpage correctly ;)\r
+\r
+ notmuch-new.c | 8 +++++---\r
+ 1 files changed, 5 insertions(+), 3 deletions(-)\r
+\r
+diff --git a/notmuch-new.c b/notmuch-new.c\r
+index a569a54..c536873 100644\r
+--- a/notmuch-new.c\r
++++ b/notmuch-new.c\r
+@@ -559,12 +559,14 @@ add_files_recursive (notmuch_database_t *notmuch,\r
+ DONE:\r
+ if (next)\r
+ talloc_free (next);\r
+- if (entry)\r
+- free (entry);\r
+ if (dir)\r
+ closedir (dir);\r
+- if (fs_entries)\r
++ if (fs_entries){\r
++ for (i = 0; i < num_fs_entries; i++){\r
++ free (fs_entries[i]);\r
++ }\r
+ free (fs_entries);\r
++ }\r
+ if (db_subdirs)\r
+ notmuch_filenames_destroy (db_subdirs);\r
+ if (db_files)\r
+-- \r
+1.7.5.4\r
+\r