From 4fadc96824c03a917bda89a598e970cdbeb24ac1 Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Thu, 2 Feb 2023 15:12:55 +0000 Subject: [PATCH] ITS#9997 syncrepl: plug potential leak in changelog search Note this is only used with changelog, which is nonstandard and obsolete. --- servers/slapd/syncrepl.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/servers/slapd/syncrepl.c b/servers/slapd/syncrepl.c index 5fceb63dca..3b02a3b5ef 100644 --- a/servers/slapd/syncrepl.c +++ b/servers/slapd/syncrepl.c @@ -604,8 +604,10 @@ ldap_sync_search( lattrs[2] = NULL; rc = ldap_search_ext_s( si->si_ld, "", LDAP_SCOPE_BASE, generic_filterstr.bv_val, lattrs, 0, NULL, NULL, NULL, si->si_slimit, &res ); - if ( rc ) + if ( rc ) { + ldap_msgfree( res ); return rc; + } msg = ldap_first_message( si->si_ld, res ); if ( msg && ldap_msgtype( msg ) == LDAP_RES_SEARCH_ENTRY ) { BerElement *ber = NULL; -- 2.47.2