Re: [PATCH] Fix memory leak in virNWFilterDefParseXML()

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

 



On Fri, Nov 29, 2013 at 8:54 PM, Daniel P. Berrange <berrange@xxxxxxxxxx> wrote:
> On Fri, Nov 29, 2013 at 08:40:31PM +0530, Nehal J Wani wrote:
>> >
>> > I think it is preferrable to use virNWFilterEntryFree() here.
>> >
>> >>              if (entry->rule || entry->include) {
>> >
>> > Just following this line there is another call to VIR_FREE(entry)
>> > which leaks entry->rule and entry->include. This should be made
>> > to call virNWFilterEntryFree too
>> >
>> >
>>
>> Would it be better to remove all the VIR_FREE(entry) and just put one
>> virNWFilterEntryFree(entry) below the label cleanup ?
>
> Yes, just make sure it is always initialized sanely.
>

Just realized.. variable entry is malloc'd each time in a loop, so it
cannot be freed inside cleanup. Sending patch v2

-- 
Nehal J Wani

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]