[PATCH] drop unnecessary copying in credential_ask_one
- From
Tay Ray Chuan <rctay89@gmail.com>
- Date
- Jan 2, 2014, 01:06 UTC
- Message-ID
- <1388624793-5563-1-git-send-email-rctay89@gmail.com>
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