[lvm-devel] [PATCH 10/23] Fix memory leak of dev_filter on error path

Alasdair G Kergon agk at redhat.com
Wed Jan 5 00:35:05 UTC 2011


On Wed, Dec 22, 2010 at 11:05:14AM +0100, Zdenek Kabelac wrote:
> I'm not sure about the best logic - so used this as a plain proposal - of
> course both variants could be seen as valid. And as I've been already fixing
> error messages in the function it self, I've put the call of destructor there.
> 
> My idea was - one the persistent_filter_create() is called - it takes
> ownership of the passed struct dev_filter.
 
I don't think it matters which you pick, but add comments to make it clear
who's responsible for cleanup.

Alasdair




More information about the lvm-devel mailing list