From: Tay Ray Chuan <rctay89@gmail.com>
To: "Git Mailing List" <git@vger.kernel.org>
Cc: "Junio C Hamano" <gitster@pobox.com>,
Tay Ray Chuan <rctay89@gmail.com>, Jeff King <peff@peff.net>
Subject: [PATCH] drop unnecessary copying in credential_ask_one
Date: Thu, 2 Jan 2014 09:06:33 +0800 [thread overview]
Message-ID: <1388624793-5563-1-git-send-email-rctay89@gmail.com> (raw)
We were leaking memory in there, as after obtaining a string from
git_getpass, we returned a copy of it, yet no one else held the original
string, apart from credential_ask_one.
Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>
---
credential.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/credential.c b/credential.c
index 86397f3..0d02ad8 100644
--- a/credential.c
+++ b/credential.c
@@ -54,7 +54,7 @@ static char *credential_ask_one(const char *what, struct credential *c)
strbuf_release(&desc);
strbuf_release(&prompt);
- return xstrdup(r);
+ return r;
}
static void credential_getpass(struct credential *c)
--
1.8.5-rc2
next reply other threads:[~2014-01-02 1:07 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-02 1:06 Tay Ray Chuan [this message]
2014-01-02 3:03 ` [PATCH] drop unnecessary copying in credential_ask_one Jeff King
2014-01-02 7:38 ` Jeff King
2014-01-02 19:08 ` Junio C Hamano
2014-01-07 17:50 ` Jeff King
2014-01-07 19:44 ` Junio C Hamano
2014-01-07 20:02 ` Jeff King
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1388624793-5563-1-git-send-email-rctay89@gmail.com \
--to=rctay89@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=peff@peff.net \
/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.
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 NNTP newsgroup(s).