From: "Adeodato Simó" <dato@net.com.org.es>
To: git@vger.kernel.org, gitster@pobox.com
Cc: "Adeodato Simó" <dato@net.com.org.es>
Subject: [PATCH] builtin-shortlog.c: do not unnecessarily strdup before insertion in list
Date: Wed, 24 Dec 2008 17:34:44 +0100 [thread overview]
Message-ID: <1230136484-12445-1-git-send-email-dato@net.com.org.es> (raw)
The log->list always has "strdup_strings" activated, hence strdup'ing
namebuf was unnecessary. This change also removes a latent memory leak
in the old code.
Signed-off-by: Adeodato Simó <dato@net.com.org.es>
---
builtin-shortlog.c | 5 +----
1 files changed, 1 insertions(+), 4 deletions(-)
diff --git a/builtin-shortlog.c b/builtin-shortlog.c
index 4c5d761..90e76ae 100644
--- a/builtin-shortlog.c
+++ b/builtin-shortlog.c
@@ -67,12 +67,9 @@ static void insert_one_record(struct shortlog *log,
snprintf(namebuf + len, room, " %.*s", maillen, boemail);
}
- buffer = xstrdup(namebuf);
- item = string_list_insert(buffer, &log->list);
+ item = string_list_insert(namebuf, &log->list);
if (item->util == NULL)
item->util = xcalloc(1, sizeof(struct string_list));
- else
- free(buffer);
/* Skip any leading whitespace, including any blank lines. */
while (*oneline && isspace(*oneline))
--
1.6.0.4
reply other threads:[~2008-12-24 16:48 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=1230136484-12445-1-git-send-email-dato@net.com.org.es \
--to=dato@net.com.org.es \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/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