--- /dev/null
+Return-Path: <amdragon@mit.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 6E38A431FAF\r
+ for <notmuch@notmuchmail.org>; Thu, 7 Aug 2014 11:24:17 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -2.3\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-2.3 tagged_above=-999 required=5\r
+ tests=[RCVD_IN_DNSWL_MED=-2.3] 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 WSaZ3dUdM1Kw for <notmuch@notmuchmail.org>;\r
+ Thu, 7 Aug 2014 11:24:11 -0700 (PDT)\r
+Received: from dmz-mailsec-scanner-8.mit.edu (dmz-mailsec-scanner-8.mit.edu\r
+ [18.7.68.37])\r
+ (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))\r
+ (No client certificate requested)\r
+ by olra.theworths.org (Postfix) with ESMTPS id 296E9431FAE\r
+ for <notmuch@notmuchmail.org>; Thu, 7 Aug 2014 11:24:11 -0700 (PDT)\r
+X-AuditID: 12074425-f79766d000006da8-74-53e3c44a11d0\r
+Received: from mailhub-auth-4.mit.edu ( [18.7.62.39])\r
+ (using TLS with cipher AES256-SHA (256/256 bits))\r
+ (Client did not present a certificate)\r
+ by dmz-mailsec-scanner-8.mit.edu (Symantec Messaging Gateway) with SMTP\r
+ id FD.9A.28072.A44C3E35; Thu, 7 Aug 2014 14:24:10 -0400 (EDT)\r
+Received: from outgoing.mit.edu (outgoing-auth-1.mit.edu [18.9.28.11])\r
+ by mailhub-auth-4.mit.edu (8.13.8/8.9.2) with ESMTP id s77IO8F6003230; \r
+ Thu, 7 Aug 2014 14:24:09 -0400\r
+Received: from awakening.csail.mit.edu (awakening.csail.mit.edu [18.26.4.91])\r
+ (authenticated bits=0)\r
+ (User authenticated as amdragon@ATHENA.MIT.EDU)\r
+ by outgoing.mit.edu (8.13.8/8.12.4) with ESMTP id s77IO50K004386\r
+ (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT);\r
+ Thu, 7 Aug 2014 14:24:07 -0400\r
+Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.80)\r
+ (envelope-from <amdragon@mit.edu>)\r
+ id 1XFSM8-0001j4-Ag; Thu, 07 Aug 2014 14:24:04 -0400\r
+Date: Thu, 7 Aug 2014 14:24:03 -0400\r
+From: Austin Clements <amdragon@MIT.EDU>\r
+To: Tomi Ollila <tomi.ollila@iki.fi>\r
+Subject: Re: [PATCH] notmuch-config: talloc_strdup MAILDIR and NAME\r
+ environment variables\r
+Message-ID: <20140807182402.GA4741@mit.edu>\r
+References: <1407424790-12538-1-git-send-email-tomi.ollila@iki.fi>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=us-ascii\r
+Content-Disposition: inline\r
+In-Reply-To: <1407424790-12538-1-git-send-email-tomi.ollila@iki.fi>\r
+User-Agent: Mutt/1.5.21 (2010-09-15)\r
+X-Brightmail-Tracker:\r
+ H4sIAAAAAAAAA+NgFmpileLIzCtJLcpLzFFi42IRYrdT1/U68jjY4N0lGYvrN2cyW7xZOY/V\r
+ gcnj8NeFLB7PVt1iDmCK4rJJSc3JLEst0rdL4Mpo2rqapaCBs2LTfr0Gxt9sXYycHBICJhJn\r
+ LpxnhLDFJC7cWw8U5+IQEpjNJHHu5zMWCGcDo8TUO9uhnFNMEjMXHWeFcJYwShz/3MEO0s8i\r
+ oCIxc/0bZhCbTUBDYtv+5WBzRYDiD9rWs4LYzALSEt9+NzOB2MIC0RKrZj4Gi/MKaEvs/3WZ\r
+ BcQWEnCS+PdxHxtEXFDi5MwnLBC9WhI3/r0E6uUAm7P8HweIySngLPHyRABIhSjQpiknt7FN\r
+ YBSahaR5FpLmWQjNCxiZVzHKpuRW6eYmZuYUpybrFicn5uWlFula6OVmluilppRuYgQHtYvq\r
+ DsYJh5QOMQpwMCrx8Ap0Pw4WYk0sK67MPcQoycGkJMrbuR8oxJeUn1KZkVicEV9UmpNafIhR\r
+ goNZSYRXF6ScNyWxsiq1KB8mJc3BoiTO+9baKlhIID2xJDU7NbUgtQgmK8PBoSTBy3sYqFGw\r
+ KDU9tSItM6cEIc3EwQkynAdoeAdIDW9xQWJucWY6RP4Uo6KUOO/ZQ0AJAZBERmkeXC8s6bxi\r
+ FAd6RZg3B6SdB5iw4LpfAQ1mAhosqwo2uCQRISXVwOjW997aRviB/63SnYeuHllT9Sz8xYl1\r
+ zybIPV8d9Vh446cZu36evXfj+2yTNTvn3zld7r1ocluly/GSCrPPU555ZIs9rD/r8kPxjklu\r
+ VUGQ4Ku7St2sz7/ujXxxaOPHIzODfofbzXU02dcdslWx9ExGsfqDTybJjQevMKpyWN54HLH5\r
+ 2RkNO90aJZbijERDLeai4kQAKd3h0xUDAAA=\r
+Cc: notmuch@notmuchmail.org\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: Thu, 07 Aug 2014 18:24:17 -0000\r
+\r
+LGTM.\r
+\r
+Quoth Tomi Ollila on Aug 07 at 6:19 pm:\r
+> When defined -- the pointer is soon given to talloc_free() which\r
+> expects it to be allocated by talloc.\r
+> ---\r
+> notmuch-config.c | 8 ++++++--\r
+> 1 file changed, 6 insertions(+), 2 deletions(-)\r
+> \r
+> diff --git a/notmuch-config.c b/notmuch-config.c\r
+> index 88831e2..db487db 100644\r
+> --- a/notmuch-config.c\r
+> +++ b/notmuch-config.c\r
+> @@ -324,7 +324,9 @@ notmuch_config_open (void *ctx,\r
+> \r
+> if (notmuch_config_get_database_path (config) == NULL) {\r
+> char *path = getenv ("MAILDIR");\r
+> - if (! path)\r
+> + if (path)\r
+> + path = talloc_strdup (config, path);\r
+> + else\r
+> path = talloc_asprintf (config, "%s/mail",\r
+> getenv ("HOME"));\r
+> notmuch_config_set_database_path (config, path);\r
+> @@ -333,7 +335,9 @@ notmuch_config_open (void *ctx,\r
+> \r
+> if (notmuch_config_get_user_name (config) == NULL) {\r
+> char *name = getenv ("NAME");\r
+> - if (! name)\r
+> + if (name)\r
+> + name = talloc_strdup (config, name);\r
+> + else\r
+> name = get_name_from_passwd_file (config);\r
+> notmuch_config_set_user_name (config, name);\r
+> talloc_free (name);\r