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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

On Sat, 7 Jul 2007, Ren? Scharfe wrote:

> Johannes Schindelin schrieb:
> > 
> > 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.

Yeah, the old code was buggy.

> And the workaround used in builtin-shortlog.c, viz. setting 
> .strdup_paths just before calling path_list_clear(), still works.

Yeah, but it is ugly.

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

Yes.

Ciao,
Dscho

-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux