builtin-shortlog.c: do not unnecessarily strdup before insertion in list
PATCH 1/1 builtin-shortlog.c: do not unnecessarily strdup before insertion in list
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ó <[email protected]>
--- builtin-shortlog.c | 5 +---- 1 files changed, 1 insertions(+), 4 deletions(-)
builtin-shortlog.c +1 -4
@@ -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))
Signature · 1 line
1.6.0.4