git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 3/3] blame,shortlog: don't make local option variables static

From
Jeff King <peff@peff.net>
Date
Jun 14, 2016, 05:05 UTC
Message-ID
<20160614050541.GA9909@sigill.intra.peff.net>
In-Reply-To
<CAPig+cQudTwT6H35YgEvxdK9AAn0BwvUC8bi8-DxGYNh9rb_Lw@mail.gmail.com>
On Tue, Jun 14, 2016 at 12:32:15AM -0400, Eric Sunshine wrote:
Show 13 quoted lines
> > +       struct string_list range_list = STRING_LIST_INIT_NODUP;
> 
> Related to this series, there's an additional "fix" which ought to be
> made, probably as a separate patch. In particular, in cmd_blame():
> 
>     if (lno && !range_list.nr)
>         string_list_append(&range_list, xstrdup("1"));
> 
> which supplies a default range ("line 1 through end of file") if -L
> was not specified. I used xstrdup() on the literal "1" in 58dbfa2
> (blame: accept multiple -L ranges, 2013-08-06) to be consistent with
> parse_opt_string_list() which was unconditionally xstrdup'ing the
> argument (but no longer does as of patch 1/3 of this series).

Yeah, I'd agree that this is a minor bug both before and after the series due to the leak. Want to roll a patch on top?

-Peff
Previous: Eric SunshineNext: Jeff King
Message 9 of 15 in “parse-options-cb.c: use string_list_append_nodup in OPT_STRING_LIST()”
  1. parse-options-cb.c: use string_list_append_nodup in OPT_STRING_LIST()Nguyễn Thái Ngọc Duy, Jun 10, 2016
  2. Jeff KingJun 12, 2016
  3. Duy NguyenJun 13, 2016
  4. 0/3 fix parse-opt string_list leaksJeff King, Jun 13, 2016
  5. 1/3 parse_opt_string_list: stop allocating new stringsJeff King, Jun 13, 2016
  6. 2/3 interpret-trailers: don't duplicate option stringsJeff King, Jun 13, 2016
  7. 3/3 blame,shortlog: don't make local option variables staticJeff King, Jun 13, 2016
  8. Eric SunshineJun 14, 2016
  9. Jeff KingJun 14, 2016
  10. blame: drop strdup of string literalJeff King, Aug 2, 2016
  11. Eric SunshineAug 3, 2016
  12. Duy NguyenJun 13, 2016
  13. 4/3 use string_list initializer consistentlyJeff King, Jun 13, 2016
  14. Duy NguyenJun 13, 2016
  15. Jeff KingJun 13, 2016

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.