git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drop unnecessary copying in credential_ask_one
@ 2014-01-02  1:06 Tay Ray Chuan
  2014-01-02  3:03 ` Jeff King
  0 siblings, 1 reply; 7+ messages in thread
From: Tay Ray Chuan @ 2014-01-02  1:06 UTC (permalink / raw)
  To: Git Mailing List; +Cc: Junio C Hamano, Tay Ray Chuan, Jeff King

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

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2014-01-07 20:02 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-02  1:06 [PATCH] drop unnecessary copying in credential_ask_one Tay Ray Chuan
2014-01-02  3:03 ` 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

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).