Subject: Re: [PATCH 7/7] commit-tree: free commit message before exiting

From: Jonathan Nieder <[email-masked]>
Date: Sun, 3 Oct 2010 23:18:34 -0500

Junio C Hamano wrote:

> Read what the code does (e.g. calling
> git-config, showing usage or dying on sick arguments, etc.).  So I have to
> say that the proposed commit log message advertises a benefit that it does
> not bring.

Yep, that was sloppy of me.  commit-tree has already been libified.

> By the way, is there an easy and concise way to tell valgrind to
> 
>  (1) treat allocations made in main() that are not freed as non-issues;
>      and
> 
>  (2) treat functions whose name begin with cmd_ as if they are all their
>      own main(), and apply the above special casing to them?

As long as the term "allocation" is defined clearly.  For example
(written in the modern syntax for conciseness):

	{
		xmalloc from main()
		Memcheck:Leak
		...
		fun:xmalloc
		fun:main
	}
	{
		xmalloc from built-in main
		Memcheck:Leak
		...
		fun:xmalloc
		fun:cmd_*
	}

Even better would be to exit() instead of returning from cmd_
functions.  Valgrind will not consider any memory that still has a
pointer to it at exit time as a leak.