Fix memory leak on notifications.c and xodtemplate.c

Andreas Ericsson ae at op5.se
Mon Oct 10 15:02:35 CEST 2011


On 10/10/2011 02:21 PM, Dorian Guillois wrote:
> Hi,
> 
> I found another memory leak in service_notification and
> host_notification functions into notifications.c and


This breaks things though. If all volatile macros are free()'d and
there's more than one contact to notify, the rest of the contacts
won't get all the macros they actually need (such as hostname,
service description and things like that). That's why we don't call
clear_volatile_macros_r() from there in the first place.

Since I'm guessing you've run this through valgrind, it should be
fairly easy to locate the spot where the leak happens and thus fix
it properly by just releasing the leaked memory.

> xodtemplate_read_config_data function into xodtemplate.c.
> 

This one looks good though, even though it's a one-time leak in a
very rarely used codepath. I doubt anyone would stumble across it in
a normal setup, but good catch all the same.

-- 
Andreas Ericsson                   andreas.ericsson at op5.se
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231

Considering the successes of the wars on alcohol, poverty, drugs and
terror, I think we should give some serious thought to declaring war
on peace.

------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2dcopy1




More information about the Developers mailing list