From 7794001ce290eda36a8f2d11829478e5cbf1fb8b Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Sun, 7 Aug 2022 08:24:34 +0100 Subject: [PATCH] Don't free arrays. --- plugins/dynamic-security/clients.c | 6 ------ plugins/dynamic-security/groups.c | 2 -- plugins/dynamic-security/roles.c | 2 -- 3 files changed, 10 deletions(-) diff --git a/plugins/dynamic-security/clients.c b/plugins/dynamic-security/clients.c index 87057c9b..a2c7cbd9 100644 --- a/plugins/dynamic-security/clients.c +++ b/plugins/dynamic-security/clients.c @@ -160,7 +160,6 @@ int dynsec_clients__config_load(struct dynsec__data *data, cJSON *tree) iterations = (int)j_iterations->valuedouble; if(iterations < 1){ - mosquitto_free(client->username); mosquitto_free(client); continue; }else{ @@ -170,7 +169,6 @@ int dynsec_clients__config_load(struct dynsec__data *data, cJSON *tree) if(base64__decode(j_salt->valuestring, &buf, &buf_len) != MOSQ_ERR_SUCCESS || buf_len > sizeof(client->pw.salt)){ - mosquitto_free(client->username); mosquitto_free(client); continue; } @@ -181,7 +179,6 @@ int dynsec_clients__config_load(struct dynsec__data *data, cJSON *tree) if(base64__decode(j_password->valuestring, &buf, &buf_len) != MOSQ_ERR_SUCCESS || buf_len != sizeof(client->pw.password_hash)){ - mosquitto_free(client->username); mosquitto_free(client); continue; } @@ -197,7 +194,6 @@ int dynsec_clients__config_load(struct dynsec__data *data, cJSON *tree) if(jtmp != NULL && cJSON_IsString(jtmp)){ client->clientid = mosquitto_strdup(jtmp->valuestring); if(client->clientid == NULL){ - mosquitto_free(client->username); mosquitto_free(client); continue; } @@ -209,7 +205,6 @@ int dynsec_clients__config_load(struct dynsec__data *data, cJSON *tree) client->text_name = mosquitto_strdup(jtmp->valuestring); if(client->text_name == NULL){ mosquitto_free(client->clientid); - mosquitto_free(client->username); mosquitto_free(client); continue; } @@ -222,7 +217,6 @@ int dynsec_clients__config_load(struct dynsec__data *data, cJSON *tree) if(client->text_description == NULL){ mosquitto_free(client->text_name); mosquitto_free(client->clientid); - mosquitto_free(client->username); mosquitto_free(client); continue; } diff --git a/plugins/dynamic-security/groups.c b/plugins/dynamic-security/groups.c index 56739aa4..7ac96516 100644 --- a/plugins/dynamic-security/groups.c +++ b/plugins/dynamic-security/groups.c @@ -229,7 +229,6 @@ int dynsec_groups__config_load(struct dynsec__data *data, cJSON *tree) if(str){ group->text_name = strdup(str); if(group->text_name == NULL){ - mosquitto_free(group->groupname); mosquitto_free(group); continue; } @@ -242,7 +241,6 @@ int dynsec_groups__config_load(struct dynsec__data *data, cJSON *tree) group->text_description = strdup(str); if(group->text_description == NULL){ mosquitto_free(group->text_name); - mosquitto_free(group->groupname); mosquitto_free(group); continue; } diff --git a/plugins/dynamic-security/roles.c b/plugins/dynamic-security/roles.c index fc7e0e8f..321bbd60 100644 --- a/plugins/dynamic-security/roles.c +++ b/plugins/dynamic-security/roles.c @@ -278,7 +278,6 @@ int dynsec_roles__config_load(struct dynsec__data *data, cJSON *tree) if(jtmp != NULL){ role->text_name = mosquitto_strdup(jtmp->valuestring); if(role->text_name == NULL){ - mosquitto_free(role->rolename); mosquitto_free(role); continue; } @@ -290,7 +289,6 @@ int dynsec_roles__config_load(struct dynsec__data *data, cJSON *tree) role->text_description = mosquitto_strdup(jtmp->valuestring); if(role->text_description == NULL){ mosquitto_free(role->text_name); - mosquitto_free(role->rolename); mosquitto_free(role); continue; }