|
|
|
@ -75,6 +75,7 @@ int handle__unsubscribe(struct mosquitto_db *db, struct mosquitto *context)
|
|
|
|
|
while(context->in_packet.pos < context->in_packet.remaining_length){
|
|
|
|
|
sub = NULL;
|
|
|
|
|
if(packet__read_string(&context->in_packet, &sub, &slen)){
|
|
|
|
|
mosquitto__free(reason_codes);
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -83,6 +84,7 @@ int handle__unsubscribe(struct mosquitto_db *db, struct mosquitto *context)
|
|
|
|
|
"Empty unsubscription string from %s, disconnecting.",
|
|
|
|
|
context->id);
|
|
|
|
|
mosquitto__free(sub);
|
|
|
|
|
mosquitto__free(reason_codes);
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
if(mosquitto_sub_topic_check(sub)){
|
|
|
|
@ -90,6 +92,7 @@ int handle__unsubscribe(struct mosquitto_db *db, struct mosquitto *context)
|
|
|
|
|
"Invalid unsubscription string from %s, disconnecting.",
|
|
|
|
|
context->id);
|
|
|
|
|
mosquitto__free(sub);
|
|
|
|
|
mosquitto__free(reason_codes);
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -97,7 +100,10 @@ int handle__unsubscribe(struct mosquitto_db *db, struct mosquitto *context)
|
|
|
|
|
rc = sub__remove(db, context, sub, db->subs, &reason);
|
|
|
|
|
log__printf(NULL, MOSQ_LOG_UNSUBSCRIBE, "%s %s", context->id, sub);
|
|
|
|
|
mosquitto__free(sub);
|
|
|
|
|
if(rc) return rc;
|
|
|
|
|
if(rc){
|
|
|
|
|
mosquitto__free(reason_codes);
|
|
|
|
|
return rc;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
reason_codes[reason_code_count] = reason;
|
|
|
|
|
reason_code_count++;
|
|
|
|
@ -122,4 +128,3 @@ int handle__unsubscribe(struct mosquitto_db *db, struct mosquitto *context)
|
|
|
|
|
mosquitto__free(reason_codes);
|
|
|
|
|
return rc;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|