Fix config->user not being freed on exit.

Closes #1564. Thanks to back1127.
pull/1586/head
Roger A. Light 6 years ago
parent 812c0636d5
commit 9ae38788dc

@ -7,6 +7,7 @@ Broker:
- Strip whitespace from end of config file string options. Closes #1566.
- Satisfy valgrind when exiting on error due to not being able to open a
listening socket, by calling freeaddrinfo. Closes #1565.
- Fix config->user not being freed on exit. Closes #1564.
1.6.8 - 20191128

@ -292,6 +292,7 @@ void config__cleanup(struct mosquitto__config *config)
mosquitto__free(config->security_options.password_file);
mosquitto__free(config->security_options.psk_file);
mosquitto__free(config->pid_file);
mosquitto__free(config->user);
if(config->listeners){
for(i=0; i<config->listener_count; i++){
mosquitto__free(config->listeners[i].host);
@ -536,7 +537,10 @@ int config__parse_args(struct mosquitto_db *db, struct mosquitto__config *config
/* Default to drop to mosquitto user if we are privileged and no user specified. */
if(!config->user){
config->user = "mosquitto";
config->user = mosquitto__strdup("mosquitto");
if(config->user == NULL){
return MOSQ_ERR_NOMEM;
}
}
if(db->verbose){
config->log_type = INT_MAX;

Loading…
Cancel
Save