git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "René Scharfe" <rene.scharfe@lsrfire.ath.cx>
To: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Cc: Junio C Hamano <junkio@cox.net>, Git Mailing List <git@vger.kernel.org>
Subject: Re: [PATCH] path-list.c: always free strdup'ed paths
Date: Sat, 07 Jul 2007 22:03:42 +0200	[thread overview]
Message-ID: <468FF19E.8020406@lsrfire.ath.cx> (raw)
In-Reply-To: <Pine.LNX.4.64.0707072036530.4093@racer.site>

Johannes Schindelin schrieb:
> 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 patch doesn't take that away, i.e. .path fields are not freed if
.strdup_paths is not set, both before and after the patch.  And the
workaround used in builtin-shortlog.c, viz. setting .strdup_paths just
before calling path_list_clear(), still works.

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

Indeed; this is a good reason to separate freeing of .util and .path, no?

René

  reply	other threads:[~2007-07-07 20:03 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-07 19:41 [PATCH] path-list.c: always free strdup'ed paths René Scharfe
2007-07-07 19:39 ` Johannes Schindelin
2007-07-07 20:03   ` René Scharfe [this message]
2007-07-07 20:27     ` Johannes Schindelin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=468FF19E.8020406@lsrfire.ath.cx \
    --to=rene.scharfe@lsrfire.ath.cx \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=junkio@cox.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).