mirror of
https://github.com/emqx/neuron.git
synced 2026-10-22 09:23:52 +08:00
Merge pull request #482 from gc87/fix-mqtt-dfree-isu481
fix(mqtt): upload topic str double free
This commit is contained in:
@@ -33,8 +33,6 @@ typedef struct {
|
||||
int verbose;
|
||||
/* MQTT options */
|
||||
int MQTT_version; // 3-3_1, 4-3_3_1, 5-5
|
||||
char *topic;
|
||||
char *respons_topic;
|
||||
char *clientid;
|
||||
int qos;
|
||||
int retained;
|
||||
@@ -52,7 +50,6 @@ typedef struct {
|
||||
int will_qos;
|
||||
int will_retain;
|
||||
/* TLS options */
|
||||
char *ca_path;
|
||||
char *ca;
|
||||
char *cert;
|
||||
char *key;
|
||||
|
||||
+1
-1
@@ -147,7 +147,7 @@ static void topics_generate(vector_t *topics, char *name, char *upload_topic)
|
||||
char *upload_req = NULL;
|
||||
char *upload_res = NULL;
|
||||
if (NULL != upload_topic && 0 < strlen(upload_topic)) {
|
||||
upload_res = upload_topic;
|
||||
upload_res = strdup(upload_topic);
|
||||
} else {
|
||||
upload_res = real_topic_generate(TOPIC_UPLOAD_RES, name);
|
||||
}
|
||||
|
||||
@@ -29,11 +29,6 @@
|
||||
#include <json/neu_json_param.h>
|
||||
#include <neuron.h>
|
||||
|
||||
#define MQTT_CERT_PATH "config"
|
||||
#define MQTT_CA_FILE "mqtt_ca.crt"
|
||||
#define MQTT_CERT_FILE "mqtt_cert.crt"
|
||||
#define MQTT_KEY_FILE "mqtt_key.key"
|
||||
|
||||
void mqtt_option_uninit(neu_mqtt_option_t *option)
|
||||
{
|
||||
if (NULL != option->clientid) {
|
||||
@@ -46,16 +41,6 @@ void mqtt_option_uninit(neu_mqtt_option_t *option)
|
||||
option->upload_topic = NULL;
|
||||
}
|
||||
|
||||
if (NULL != option->topic) {
|
||||
free(option->topic);
|
||||
option->topic = NULL;
|
||||
}
|
||||
|
||||
if (NULL != option->respons_topic) {
|
||||
free(option->respons_topic);
|
||||
option->respons_topic = NULL;
|
||||
}
|
||||
|
||||
if (NULL != option->connection) {
|
||||
free(option->connection);
|
||||
option->connection = NULL;
|
||||
@@ -81,11 +66,6 @@ void mqtt_option_uninit(neu_mqtt_option_t *option)
|
||||
option->password = NULL;
|
||||
}
|
||||
|
||||
if (NULL != option->ca_path) {
|
||||
free(option->ca_path);
|
||||
option->ca_path = NULL;
|
||||
}
|
||||
|
||||
if (NULL != option->ca) {
|
||||
free(option->ca);
|
||||
option->ca = NULL;
|
||||
|
||||
Reference in New Issue
Block a user