Re: [PATCH 7/7] commit-tree: free commit message before exiting
- From
Jonathan Nieder <jrnieder@gmail.com>
- Date
- Oct 4, 2010, 04:18 UTC
- Message-ID
- <20101004041834.GD24884@burratino>
- In-Reply-To
- <7vlj6edcic.fsf@alter.siamese.dyndns.org>
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.
Show 7 quoted lines
> 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.