From: "Dirk-Jan C. Binnema" <djcb.bulk@gmail.com>
To: notmuch@notmuchmail.org
Subject: [PATCH 2/2] * free the response data from 'prompt'
Date: Wed, 2 Dec 2009 09:11:25 +0200 [thread overview]
Message-ID: <1259737885-15103-2-git-send-email-djcb.bulk@gmail.com> (raw)
In-Reply-To: <1259737885-15103-1-git-send-email-djcb.bulk@gmail.com>
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 <djcb.bulk@gmail.com>
---
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
next prev parent reply other threads:[~2009-12-02 7:11 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-12-02 7:11 [PATCH 1/2] * notmuch-config: fix small leak from 'g_key_file_to_data' Dirk-Jan C. Binnema
2009-12-02 7:11 ` Dirk-Jan C. Binnema [this message]
2009-12-04 19:18 ` [PATCH 2/2] * free the response data from 'prompt' Carl Worth
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://notmuchmail.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1259737885-15103-2-git-send-email-djcb.bulk@gmail.com \
--to=djcb.bulk@gmail.com \
--cc=notmuch@notmuchmail.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://yhetil.org/notmuch.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).