[Nagiosplug-devel] Nagiosplugins 1.4.11 on HP UX
Holger Weiss
holger at CIS.FU-Berlin.DE
Mon Feb 11 23:46:11 CET 2008
* Ton Voon <ton.voon at altinity.com> [2008-02-11 21:28]:
> On 11 Feb 2008, at 15:47, Holger Weiss wrote:
> > if (*my_thresholds > 0) { /* Not sure why, but sometimes could be -1 */
> > /* printf("Freeing here: %d\n", *my_thresholds); */
> > free(*my_thresholds);
> > }
> >
> > Removing these lines creates a minor memory leak, but that won't be a
> > problem in practice. A proper fix will require a little more work.
>
> Ah! That's my ugly code there :(
>
> What's a proper fix?
*my_thresholds is a pointer and from the comment that *my_thresholds
sometimes was -1 I assumed that it may be uninitialized in some cases
(so that it neither points to allocated memory nor to NULL). This is
the only possible reason I see that it could ever equal -1 (apart from
memory being corrupted).
However, I now looked through our code and couldn't find any instance
where *my_thresholds isn't initialized to NULL. So, I have no idea how
it could ever equal -1. Do you happen to remember any details? Any
idea how we could try to reproduce that?
Holger
More information about the Devel
mailing list