git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] builtin-shortlog.c: do not unnecessarily strdup before insertion in list
@ 2008-12-24 16:34 Adeodato Simó
  0 siblings, 0 replies; only message in thread
From: Adeodato Simó @ 2008-12-24 16:34 UTC (permalink / raw)
  To: git, gitster; +Cc: Adeodato Simó

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

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2008-12-24 16:48 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-12-24 16:34 [PATCH] builtin-shortlog.c: do not unnecessarily strdup before insertion in list Adeodato Simó

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