Fix memory leak on notifications.c and xodtemplate.c

Andreas Ericsson ae at op5.se
Mon Oct 10 21:31:12 CEST 2011


On 10/10/2011 05:37 PM, Dorian Guillois wrote:
> On Mon, Oct 10, 2011 at 3:02 PM, Andreas Ericsson<ae at op5.se>  wrote:
>> 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.
>>
> 
> In service_notification() we call
> create_notification_list_from_service() who allocate
> mac->x[MACRO_NOTIFICATIONISESCALATED] but it is impossible to release it with
> free_notification_list(). So I propose to call
> clear_volatile_macros_r() at the end of
> service_notification().
> 
> What do you think about it ?
> 
> It is the same thing for host_notification().
> 

Try this with multiple contacts getting notified, using a notification
command that uses all macros. Some macros will be missing for all
contacts beyond the first one if I'm reading the code right.

That's what I wanted you to fix.

-- 
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