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

Re: [PATCH] path-list.c: always free strdup'ed paths

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Jul 7, 2007, 19:39 UTC
Message-ID
<Pine.LNX.4.64.0707072036530.4093@racer.site>
In-Reply-To
<468FEC54.307@lsrfire.ath.cx>
Hi,
On Sat, 7 Jul 2007, Ren? Scharfe wrote:
> Always free .paths if .strdup_paths is set, no matter if the
> parameter free_items is set or not, plugging a minor memory leak.
> And to clarify the meaning of the flag, rename it to free_util,
> since it now only affects the freeing of the .util field.

The rational was that it might very well be possible that the pointers you hand to the path_list are already strdup()ed. So you do not set strdup_paths, but you want them free()d.

The .util field is in many cases something that is not trivially free()d, but has to call a type-specific function, such as path_list_clear() itself.

So I'm mildly negative about your patch.

Ciao, Dscho

Previous: René ScharfeNext: René Scharfe
Message 2 of 4 in “path-list.c: always free strdup'ed paths”
  1. path-list.c: always free strdup'ed pathsRené Scharfe, Jul 7, 2007
  2. Johannes SchindelinJul 7, 2007
  3. René ScharfeJul 7, 2007
  4. Johannes SchindelinJul 7, 2007

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.