From 0011684760c07aac82fbc119a101e8854185f4c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Kuzn=C3=ADk?= Date: Thu, 8 Feb 2018 23:47:35 +0000 Subject: [PATCH] Cleanup sasl_bind_mech resets --- servers/lloadd/bind.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/servers/lloadd/bind.c b/servers/lloadd/bind.c index 51636727a2..f803c915b4 100644 --- a/servers/lloadd/bind.c +++ b/servers/lloadd/bind.c @@ -306,14 +306,11 @@ request_bind( LloadConnection *client, LloadOperation *op ) rc = bind_mech_external( client, op, &credentials ); /* terminate the upstream side if client switched mechanisms */ - if ( !BER_BVISNULL( &client->c_sasl_bind_mech ) ) { + if ( pin ) { op->o_client_refcnt++; CONNECTION_UNLOCK_INCREF(client); operation_abandon( op ); CONNECTION_LOCK_DECREF(client); - - ber_memfree( client->c_sasl_bind_mech.bv_val ); - BER_BVZERO( &client->c_sasl_bind_mech ); } ber_free( copy, 0 ); @@ -736,6 +733,10 @@ handle_whoami_response( return -1; } upstream->c_state = LLOAD_C_READY; + if ( !BER_BVISNULL( &upstream->c_sasl_bind_mech ) ) { + ber_memfree( upstream->c_sasl_bind_mech.bv_val ); + BER_BVZERO( &upstream->c_sasl_bind_mech ); + } CONNECTION_UNLOCK_INCREF(upstream);