From cdce7a01afba954fcf64aaa30eec4d7d19b06cde Mon Sep 17 00:00:00 2001
From: Quanah Gibson-Mount <quanah@openldap.org>
Date: Tue, 4 Jan 2011 19:25:58 +0000
Subject: [PATCH] Plug one-time LDAPMessage leak

---
 clients/tools/ldapexop.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/clients/tools/ldapexop.c b/clients/tools/ldapexop.c
index 095d5e3376..b259bef03c 100644
--- a/clients/tools/ldapexop.c
+++ b/clients/tools/ldapexop.c
@@ -75,7 +75,7 @@ main( int argc, char *argv[] )
 	char		*matcheddn = NULL, *text = NULL, **refs = NULL;
 	LDAPControl **ctrls = NULL;
 	int		id, code;
-	LDAPMessage	*res;
+	LDAPMessage	*res = NULL;
 
 	tool_init( TOOL_EXOP );
 	prog = lutil_progname( "ldapexop", argc, argv );
@@ -348,6 +348,8 @@ main( int argc, char *argv[] )
 
 skip:
 	/* disconnect from server */
+	if ( res )
+		ldap_msgfree( res );
 	tool_unbind( ld );
 	tool_destroy();
 
-- 
GitLab