[Nagios-devel] NSCA memleak fix
Posted: Fri Oct 24, 2003 3:03 pm
--QWpDgw58+k1mSFBj
Content-Type: multipart/mixed; boundary="QNDPHrPUIc00TOLW"
Content-Disposition: inline
--QNDPHrPUIc00TOLW
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
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.
Unfortunately, there is still another leak in there somewhere, but it's much
much smaller now.
=46rom my testing, the leak is definately related to mcrypt; with mcrypt
disabled, there is no leak that I can see.
Patch against CVS from today is attached.
M
--QNDPHrPUIc00TOLW
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="nsca-20031024cvs-util.c-memleak.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 22:37:28 -0000
@@ -254,6 +254,14 @@
/* mcrypt cleanup */
if(encryption_method!=3DENCRYPT_NONE && encryption_method!=3DENCRY=
PT_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);
--QNDPHrPUIc00TOLW--
--QWpDgw58+k1mSFBj
Content-Type: application/pgp-signature
Content-Disposition: inline
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (FreeBSD)
iD8DBQE/masFOtZWu2tc1lARAgG9AJ95Anb1zKSBcJyPzBW3C6f9ToKWxQCfbUwf
a2gaTapJ99KUV8ZW7hKrxDY=
=/MLk
-----END PGP SIGNATURE-----
--QWpDgw58+k1mSFBj--
This post was automatically imported from historical nagios-devel mailing list archives
Original poster: [email protected]
Content-Type: multipart/mixed; boundary="QNDPHrPUIc00TOLW"
Content-Disposition: inline
--QNDPHrPUIc00TOLW
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
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.
Unfortunately, there is still another leak in there somewhere, but it's much
much smaller now.
=46rom my testing, the leak is definately related to mcrypt; with mcrypt
disabled, there is no leak that I can see.
Patch against CVS from today is attached.
M
--QNDPHrPUIc00TOLW
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="nsca-20031024cvs-util.c-memleak.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 22:37:28 -0000
@@ -254,6 +254,14 @@
/* mcrypt cleanup */
if(encryption_method!=3DENCRYPT_NONE && encryption_method!=3DENCRY=
PT_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);
--QNDPHrPUIc00TOLW--
--QWpDgw58+k1mSFBj
Content-Type: application/pgp-signature
Content-Disposition: inline
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (FreeBSD)
iD8DBQE/masFOtZWu2tc1lARAgG9AJ95Anb1zKSBcJyPzBW3C6f9ToKWxQCfbUwf
a2gaTapJ99KUV8ZW7hKrxDY=
=/MLk
-----END PGP SIGNATURE-----
--QWpDgw58+k1mSFBj--
This post was automatically imported from historical nagios-devel mailing list archives
Original poster: [email protected]