From 78a0be6a42bb6c3ddab3cf8195c00eea599768fc Mon Sep 17 00:00:00 2001 From: Hallvard Furuseth Date: Mon, 20 Dec 2010 10:51:14 +0000 Subject: [PATCH] Plug memory leaks --- clients/tools/ldapmodify.c | 2 +- servers/slapd/overlays/retcode.c | 6 ++++++ servers/slapd/syncrepl.c | 1 + tests/progs/slapd-modrdn.c | 6 ++++-- 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/clients/tools/ldapmodify.c b/clients/tools/ldapmodify.c index 5533071518..c1f2ff0017 100644 --- a/clients/tools/ldapmodify.c +++ b/clients/tools/ldapmodify.c @@ -714,7 +714,7 @@ static int process_response( if ( text ) ldap_memfree( text ); if ( matched ) ldap_memfree( matched ); - if ( text ) ber_memvfree( (void **)refs ); + if ( refs ) ber_memvfree( (void **)refs ); if ( ctrls ) { tool_print_ctrls( ld, ctrls ); diff --git a/servers/slapd/overlays/retcode.c b/servers/slapd/overlays/retcode.c index 47cf54a5c4..e77fa6d2fd 100644 --- a/servers/slapd/overlays/retcode.c +++ b/servers/slapd/overlays/retcode.c @@ -770,6 +770,12 @@ retcode_item_destroy( retcode_item_t *rdi ) entry_clean( &rdi->rdi_e ); + if ( !BER_BVISNULL( &rdi->rdi_unsolicited_oid ) ) { + ber_memfree( rdi->rdi_unsolicited_oid.bv_val ); + if ( !BER_BVISNULL( &rdi->rdi_unsolicited_data ) ) + ber_memfree( rdi->rdi_unsolicited_data.bv_val ); + } + ch_free( rdi ); } diff --git a/servers/slapd/syncrepl.c b/servers/slapd/syncrepl.c index 30cb44127e..214e2c6fb8 100644 --- a/servers/slapd/syncrepl.c +++ b/servers/slapd/syncrepl.c @@ -4059,6 +4059,7 @@ config_suffixm( ConfigArgs *c, syncinfo_t *si ) rc = rewrite_parse( si->si_rewrite, c->fname, c->lineno, 4, argvRule ); ch_free( vnc ); + ch_free( rnc ); return rc; } #endif diff --git a/tests/progs/slapd-modrdn.c b/tests/progs/slapd-modrdn.c index eb937db233..f369ce8487 100644 --- a/tests/progs/slapd-modrdn.c +++ b/tests/progs/slapd-modrdn.c @@ -303,6 +303,8 @@ done:; fprintf( stderr, " PID=%ld - Modrdn done (%d).\n", (long) pid, rc ); ldap_unbind_ext( ld, NULL, NULL ); -} - + free( DNs[1] ); + free( rdns[0] ); + free( rdns[1] ); +} -- 2.39.5