]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Slightly more efficient
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Mon, 22 Jun 2015 21:16:21 +0000 (17:16 -0400)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Mon, 22 Jun 2015 21:16:21 +0000 (17:16 -0400)
src/modules/rlm_ldap/sasl.c

index 0cd7e86ba25d2093566f33df9020a3e54c454df0..00a3ded5f6b111afffc6f142a66061c5ffe42f8f 100644 (file)
@@ -128,8 +128,6 @@ ldap_rcode_t rlm_ldap_sasl_interactive(rlm_ldap_t const *inst, REQUEST *request,
                                                 NULL, NULL, LDAP_SASL_AUTOMATIC,
                                                 _sasl_interact, &sasl_ctx, result,
                                                 &mech, &msgid);
-               ldap_msgfree(result);   /* We always need to free the old message */
-               result = NULL;
 
                /*
                 *      If ldap_sasl_interactive_bind indicates it didn't want
@@ -141,9 +139,11 @@ ldap_rcode_t rlm_ldap_sasl_interactive(rlm_ldap_t const *inst, REQUEST *request,
                 */
                if (ret != LDAP_SASL_BIND_IN_PROGRESS) {
                        status = rlm_ldap_result(inst, conn, -1, identity, NULL, error, extra);
-                       break;
+                       break;          /* Old result gets freed on after exit */
                }
 
+               ldap_msgfree(result);   /* We always need to free the old message */
+
                /*
                 *      If LDAP parse result indicates there was an error
                 *      then we're done.