Module: kamailio
Branch: master
Commit: 039a79a00e2eb34b9e61e30848f4d1bb07d68f4c
URL:
https://github.com/kamailio/kamailio/commit/039a79a00e2eb34b9e61e30848f4d1b…
Author: Victor Seva <linuxmaniac(a)torreviejawireless.org>
Committer: Victor Seva <linuxmaniac(a)torreviejawireless.org>
Date: 2024-12-12T16:40:27+01:00
mqtt: add fixup_free* to exported functions
---
Modified: src/modules/mqtt/mqtt_mod.c
---
Diff:
https://github.com/kamailio/kamailio/commit/039a79a00e2eb34b9e61e30848f4d1b…
Patch:
https://github.com/kamailio/kamailio/commit/039a79a00e2eb34b9e61e30848f4d1b…
---
diff --git a/src/modules/mqtt/mqtt_mod.c b/src/modules/mqtt/mqtt_mod.c
index f332263983f..2ce4c4772bb 100644
--- a/src/modules/mqtt/mqtt_mod.c
+++ b/src/modules/mqtt/mqtt_mod.c
@@ -57,10 +57,12 @@ static int child_init(int);
static int cmd_mqtt_publish(
sip_msg_t *msg, char *topic, char *payload, char *qos);
static int fixup_mqtt_publish(void **param, int param_no);
+static int fixup_free_mqtt_publish(void **param, int param_no);
static int ki_mqtt_publish(sip_msg_t *msg, str *topic, str *payload, int qos);
static int cmd_mqtt_subscribe(sip_msg_t *msg, char *topic, char *qos);
static int fixup_mqtt_subscribe(void **param, int param_no);
+static int fixup_free_mqtt_subscribe(void **param, int param_no);
static int ki_mqtt_subscribe(sip_msg_t *msg, str *topic, int qos);
static int cmd_mqtt_unsubscribe(sip_msg_t *msg, char *topic);
@@ -69,11 +71,11 @@ static int ki_mqtt_unsubscribe(sip_msg_t *msg, str *topic);
/* clang-format off */
static cmd_export_t cmds[] = {
{"mqtt_publish", (cmd_function)cmd_mqtt_publish, 3,
- fixup_mqtt_publish, 0, ANY_ROUTE},
+ fixup_mqtt_publish, fixup_free_mqtt_publish, ANY_ROUTE},
{"mqtt_subscribe", (cmd_function)cmd_mqtt_subscribe, 2,
- fixup_mqtt_subscribe, 0, ANY_ROUTE},
+ fixup_mqtt_subscribe, fixup_free_mqtt_subscribe, ANY_ROUTE},
{"mqtt_unsubscribe", (cmd_function)cmd_mqtt_unsubscribe, 1,
- fixup_spve_all, 0, ANY_ROUTE},
+ fixup_spve_all, fixup_free_spve_all, ANY_ROUTE},
{0, 0, 0, 0, 0, 0}
};
@@ -289,6 +291,20 @@ static int fixup_mqtt_publish(void **param, int param_no)
}
}
+static int fixup_free_mqtt_publish(void **param, int param_no)
+{
+ switch(param_no) {
+ case 1:
+ return fixup_free_spve_spve(param, param_no);
+ case 2:
+ return fixup_free_spve_spve(param, param_no);
+ case 3:
+ return 0;
+ default:
+ return -1;
+ }
+}
+
/**
* Subscribe to the given topic.
* Mqtt qos levels 0, 1 and 2 can be used.
@@ -353,6 +369,18 @@ static int fixup_mqtt_subscribe(void **param, int param_no)
}
}
+static int fixup_free_mqtt_subscribe(void **param, int param_no)
+{
+ switch(param_no) {
+ case 1:
+ return fixup_free_spve_spve(param, param_no);
+ case 2:
+ return 0;
+ default:
+ return -1;
+ }
+}
+
/**
* Unsubscribe to a previously subscribed topic.
* Used in cfg script.