Don't double free when using remote_clientid/username/password.

pull/501/head
Roger A. Light 8 years ago
parent ac6997d7bc
commit c26b852c53

@ -102,12 +102,6 @@ void context__cleanup(struct mosquitto_db *db, struct mosquitto *context, bool d
if(!context) return;
mosquitto__free(context->username);
context->username = NULL;
mosquitto__free(context->password);
context->password = NULL;
#ifdef WITH_BRIDGE
if(context->bridge){
for(i=0; i<db->bridge_count; i++){
@ -124,16 +118,29 @@ void context__cleanup(struct mosquitto_db *db, struct mosquitto *context, bool d
mosquitto__free(context->bridge->local_password);
context->bridge->local_password = NULL;
mosquitto__free(context->bridge->remote_clientid);
if(context->bridge->remote_clientid != context->id){
mosquitto__free(context->bridge->remote_clientid);
}
context->bridge->remote_clientid = NULL;
mosquitto__free(context->bridge->remote_username);
if(context->bridge->remote_username != context->username){
mosquitto__free(context->bridge->remote_username);
}
context->bridge->remote_username = NULL;
mosquitto__free(context->bridge->remote_password);
if(context->bridge->remote_password != context->password){
mosquitto__free(context->bridge->remote_password);
}
context->bridge->remote_password = NULL;
}
#endif
mosquitto__free(context->username);
context->username = NULL;
mosquitto__free(context->password);
context->password = NULL;
net__socket_close(db, context);
if((do_free || context->clean_session) && db){
sub__clean_session(db, context);

Loading…
Cancel
Save