Skip to content

Commit

Permalink
Fix missing auto id prefix for local only case
Browse files Browse the repository at this point in the history
  • Loading branch information
ralight committed Nov 11, 2024
1 parent f1e5cd7 commit 9fddc7c
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/listeners.c
Original file line number Diff line number Diff line change
Expand Up @@ -155,13 +155,21 @@ static int listeners__add_local(const char *host, uint16_t port)

listener__set_defaults(&listeners[db.config->listener_count]);
listeners[db.config->listener_count].security_options->allow_anonymous = true;
listeners[db.config->listener_count].security_options->auto_id_prefix = mosquitto_strdup("auto-");
if(listeners[db.config->listener_count].security_options->auto_id_prefix == NULL){
mosquitto_FREE(listeners[db.config->listener_count].security_options);
return MOSQ_ERR_NOMEM;
}
listeners[db.config->listener_count].security_options->auto_id_prefix_len = strlen("auto-");
listeners[db.config->listener_count].port = port;
listeners[db.config->listener_count].host = mosquitto_strdup(host);
if(listeners[db.config->listener_count].host == NULL){
mosquitto_FREE(listeners[db.config->listener_count].security_options->auto_id_prefix);
mosquitto_FREE(listeners[db.config->listener_count].security_options);
return MOSQ_ERR_NOMEM;
}
if(listeners__start_single_mqtt(&listeners[db.config->listener_count])){
mosquitto_FREE(listeners[db.config->listener_count].security_options->auto_id_prefix);
mosquitto_FREE(listeners[db.config->listener_count].security_options);
mosquitto_FREE(listeners[db.config->listener_count].host);
return MOSQ_ERR_UNKNOWN;
Expand Down

0 comments on commit 9fddc7c

Please sign in to comment.