Re: [Nagios-devel] memory leak in Nagios 2.x utils.c

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
Guest

Re: [Nagios-devel] memory leak in Nagios 2.x utils.c

Post by Guest »

eponymous alias wrote:
> The following code in Nagios 2.10 utils.c contains a memory leak:
>
> 4885
> if(service_result_buffer.items==check_result_buffer_slots){
> 4886
> 4887 /* record overflow */
> 4888 service_result_buffer.overflow++;
> 4889
> 4890 /* update tail pointer */
> 4891
> service_result_buffer.tail=(service_result_buffer.tail + 1) %
> check_result_buffer_slots;
> 4892 }
>
> One needs the following lines between the overflow increment and the
> tail increment:
>
> /* We're about to discard the oldest result, to make room for the newest.
> Make sure we don't create a memory leak in doing so. */
> free (((service_message
> **)service_result_buffer.buffer)[service_result_buffer.tail]);
>
> Even if this code path is thought never to execute, the fix should still
> be put in to guide developers who may need to modify the code base.

Thanks for the note. I'll get this in CVS shortly...


Ethan Galstad
Nagios Developer
___
Email: [email protected]
Web: www.nagios.org





This post was automatically imported from historical nagios-devel mailing list archives
Original poster: [email protected]
Locked