Only remove context from hash if there is a client id.

This should never happen, but just in case.
This commit is contained in:
Roger A. Light 2018-11-06 22:59:57 +00:00
parent 7f1419e4de
commit 93f9e965a8

View File

@ -638,9 +638,11 @@ void do_disconnect(struct mosquitto_db *db, struct mosquitto *context)
context->sock = INVALID_SOCKET;
context->pollfd_index = -1;
}
HASH_DELETE(hh_id, db->contexts_by_id, context);
context->old_id = context->id;
context->id = NULL;
if(context->id){
HASH_DELETE(hh_id, db->contexts_by_id, context);
context->old_id = context->id;
context->id = NULL;
}
}else
#endif
{