Page 1 of 1

[Nagios-devel] Re: NSCA memleak fix

Posted: Fri Oct 24, 2003 3:18 pm
by Guest
--TdMwOTenGjBWB1uY
Content-Type: multipart/mixed; boundary="HcXnUX77nabWBLF4"
Content-Disposition: inline


--HcXnUX77nabWBLF4
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

Mark Ferlatte said on Fri, Oct 24, 2003 at 03:43:17PM -0700:
> Fix for a fairly nasty memory leak in the nsca daemon. Without this patch,
> nsca was growing to ~80MB overnight under my (~1000 passive check) loads.

Crap, the previous patch was totally broken if you weren't using crypto.

New patch attached.

M

--HcXnUX77nabWBLF4
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="nsca-20031024cvs-util.c-memleak.2.patch"
Content-Transfer-Encoding: quoted-printable

Index: utils.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvsroot/nagios/nsca/src/utils.c,v
retrieving revision 1.4
diff -u -r1.4 utils.c
--- utils.c 15 Oct 2003 23:17:46 -0000 1.4
+++ utils.c 24 Oct 2003 23:08:29 -0000
@@ -252,8 +252,18 @@
=20
#ifdef HAVE_LIBMCRYPT
/* mcrypt cleanup */
- if(encryption_method!=3DENCRYPT_NONE && encryption_method!=3DENCRY=
PT_XOR)
- mcrypt_generic_end(CI->td);
+ if(encryption_method!=3DENCRYPT_NONE &&=20
+ encryption_method!=3DENCRYPT_XOR) {
+ mcrypt_generic_end(CI->td);
+ free(CI->key);
+ CI->key =3D NULL;
+ free(CI->IV);
+ CI->IV =3D NULL;
+ free(CI->mcrypt_algorithm);
+ CI->mcrypt_algorithm =3D NULL;
+ free(CI->mcrypt_mode);
+ CI->mcrypt_mode =3D NULL;
+ }
#endif
=20
free(CI);

--HcXnUX77nabWBLF4--

--TdMwOTenGjBWB1uY
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (FreeBSD)

iD8DBQE/mbNBOtZWu2tc1lARAlelAJ0dFfJjLeFTUVh2m43CRslf8mQZAwCfcbx4
pOL0pQdUdpTrraSPluzvHws=
=pFTv
-----END PGP SIGNATURE-----

--TdMwOTenGjBWB1uY--





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