From: Eric Sunshine Date: Tue, 2 Aug 2016 10:52:53 +0000 (-0400) Subject: blame: drop strdup of string literal X-Git-Tag: v2.10.0-rc0~33^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=aa59e14b23b3c075e7f50eae73d9c6812ed96959;p=thirdparty%2Fgit.git blame: drop strdup of string literal This strdup was added as part of 58dbfa2 (blame: accept multiple -L ranges, 2013-08-06) to be consistent with parse_opt_string_list(), which appends to the same list. But as of 7a7a517 (parse_opt_string_list: stop allocating new strings, 2016-06-13), we should stop using strdup (to match parse_opt_string_list, and for all the reasons described in that commit; namely that it does nothing useful and causes us to leak the memory). Signed-off-by: Eric Sunshine Signed-off-by: Jeff King Signed-off-by: Junio C Hamano --- diff --git a/builtin/blame.c b/builtin/blame.c index 9b1701d314..f3fe92643c 100644 --- a/builtin/blame.c +++ b/builtin/blame.c @@ -2748,7 +2748,7 @@ parse_done: lno = prepare_lines(&sb); if (lno && !range_list.nr) - string_list_append(&range_list, xstrdup("1")); + string_list_append(&range_list, "1"); anchor = 1; range_set_init(&ranges, range_list.nr);