From 76c5d2e088bf8aeb0c66ab334de994738a1665c5 Mon Sep 17 00:00:00 2001 From: Quanah Gibson-Mount Date: Wed, 2 Feb 2011 23:28:27 +0000 Subject: [PATCH] Fix one time memory leak --- clients/tools/ldapwhoami.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/clients/tools/ldapwhoami.c b/clients/tools/ldapwhoami.c index b8d8f3718b..e6c2a237eb 100644 --- a/clients/tools/ldapwhoami.c +++ b/clients/tools/ldapwhoami.c @@ -113,7 +113,7 @@ main( int argc, char *argv[] ) char *matcheddn = NULL, *text = NULL, **refs = NULL; struct berval *authzid = NULL; int id, code = 0; - LDAPMessage *res; + LDAPMessage *res = NULL; LDAPControl **ctrls = NULL; tool_init( TOOL_WHOAMI ); @@ -182,7 +182,6 @@ main( int argc, char *argv[] ) } rc = ldap_parse_whoami( ld, res, &authzid ); - ldap_msgfree(res); if( rc != LDAP_SUCCESS ) { tool_perror( "ldap_parse_whoami", rc, NULL, NULL, NULL, NULL ); @@ -199,6 +198,7 @@ main( int argc, char *argv[] ) } skip: + ldap_msgfree(res); if ( verbose || ( code != LDAP_SUCCESS ) || matcheddn || text || refs || ctrls ) { -- 2.39.5