[Libvir] [patch 1/5] iptables: fix invalid free

Mark McLoughlin markmc at redhat.com
Wed Mar 21 15:32:07 UTC 2007


On Wed, 2007-03-21 at 16:24 +0100, Jim Meyering wrote:
> Mark McLoughlin <markmc at redhat.com> wrote:
> ...
> >   - If our wrappers always zero-initialise, we don't need the
> >     "initialise to -1 when debugging" thing.
> 
> You probably already know, but if your wrappers always initialize,
> that can mask used-uninitialized.  So it's best if the initialization
> is only optional, so you can test (i.e. via valgrind) with it turned off.

	It doesn't mask used-uninitialised if it always initialises. If it
always initialises, then how can it be even be used uninitialised? :-)

	Seriously, if[1] you had a wrapper e.g. libvirtMalloc0() then the
intention of the function is to zero-initialise, so why would you want
valgrind to be able to find out where there might have been a bug if you
only used malloc() ?

Cheers,
Mark.

[1] - I'm not suggesting we add this. If the only purpose of the wrapper
is to zero-initialise, then we should just use calloc() instead of the
wrapper




More information about the libvir-list mailing list