Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 334F2431FBC for ; Tue, 1 Dec 2009 23:11:31 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org 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 Bv44v4QL9f+G for ; Tue, 1 Dec 2009 23:11:29 -0800 (PST) Received: from gw01.mail.saunalahti.fi (gw01.mail.saunalahti.fi [195.197.172.115]) by olra.theworths.org (Postfix) with ESMTP id 72CD9431FAE for ; Tue, 1 Dec 2009 23:11:29 -0800 (PST) Received: from djcbsoftware.nl (a88-112-254-208.elisa-laajakaista.fi [88.112.254.208]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by gw01.mail.saunalahti.fi (Postfix) with ESMTP id 56503151684; Wed, 2 Dec 2009 09:11:26 +0200 (EET) Received: by djcbsoftware.nl (Postfix, from userid 1000) id 1576339C034; Wed, 2 Dec 2009 09:11:25 +0200 (EET) From: "Dirk-Jan C. Binnema" To: notmuch@notmuchmail.org Date: Wed, 2 Dec 2009 09:11:25 +0200 Message-Id: <1259737885-15103-2-git-send-email-djcb.bulk@gmail.com> X-Mailer: git-send-email 1.6.3.3 In-Reply-To: <1259737885-15103-1-git-send-email-djcb.bulk@gmail.com> References: <1259737885-15103-1-git-send-email-djcb.bulk@gmail.com> Subject: [notmuch] [PATCH 2/2] * free the response data from 'prompt' X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.12 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: Wed, 02 Dec 2009 07:11:32 -0000 Free the results of the prompt; this patch does the minimal job for that. It may be nice to refactor the function a bit. Signed-off-by: Dirk-Jan C. Binnema --- notmuch-setup.c | 15 +++++++++++++-- 1 files changed, 13 insertions(+), 2 deletions(-) diff --git a/notmuch-setup.c b/notmuch-setup.c index 622bbaa..293c852 100644 --- a/notmuch-setup.c +++ b/notmuch-setup.c @@ -119,12 +119,16 @@ notmuch_setup_command (unused (void *ctx), prompt ("Your full name [%s]: ", notmuch_config_get_user_name (config)); if (strlen (response)) notmuch_config_set_user_name (config, response); - + free (response); + response = NULL; + prompt ("Your primary email address [%s]: ", notmuch_config_get_user_primary_email (config)); if (strlen (response)) notmuch_config_set_user_primary_email (config, response); - + free (response); + response = NULL; + other_emails = g_ptr_array_new (); old_other_emails = notmuch_config_get_user_other_email (config, @@ -136,12 +140,17 @@ notmuch_setup_command (unused (void *ctx), else g_ptr_array_add (other_emails, talloc_strdup (ctx, old_other_emails[i])); + free (response); + response = NULL; } do { prompt ("Additional email address [Press 'Enter' if none]: "); if (strlen (response)) g_ptr_array_add (other_emails, talloc_strdup (ctx, response)); + free (response); + response = NULL; + } while (strlen (response)); if (other_emails->len) notmuch_config_set_user_other_email (config, @@ -158,6 +167,8 @@ notmuch_setup_command (unused (void *ctx), absolute_path = make_path_absolute (ctx, response); notmuch_config_set_database_path (config, absolute_path); } + free (response); + response = NULL; if (! notmuch_config_save (config)) { if (is_new) -- 1.6.3.3