summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorxengineering <me@xengineering.eu>2022-09-09 20:53:48 +0200
committerxengineering <me@xengineering.eu>2022-09-09 20:54:22 +0200
commitb01b851c468a5e6335b8acb06f22dc217e33d0a9 (patch)
tree171367944b0c2606ecebbceadab7bed1e77d97bf
parent82231ee09c905ff8de8e3fba4c5b69e5f5aad08c (diff)
downloadlimox-b01b851c468a5e6335b8acb06f22dc217e33d0a9.tar
limox-b01b851c468a5e6335b8acb06f22dc217e33d0a9.tar.zst
limox-b01b851c468a5e6335b8acb06f22dc217e33d0a9.zip
Free message content in message_handler
-rw-r--r--main.c4
-rw-r--r--net.c6
2 files changed, 6 insertions, 4 deletions
diff --git a/main.c b/main.c
index 383079b..52fa721 100644
--- a/main.c
+++ b/main.c
@@ -44,7 +44,7 @@ int main(int argc, char* argv[]) {
}
-// getOpts parses all command line arguments.
+// parses all command line arguments.
static void get_opts(Options* opts, int argc, char* argv[]) {
// initialize Options struct
@@ -67,7 +67,7 @@ static void get_opts(Options* opts, int argc, char* argv[]) {
}
-// printHelp prints out the help page.
+// prints out the help page.
static void print_help(void) {
fprintf(stderr,
diff --git a/net.c b/net.c
index dc0f5de..0018de7 100644
--- a/net.c
+++ b/net.c
@@ -37,8 +37,8 @@ static long flags;
static xmpp_sm_state_t* sm_state;
-static int message_handler(xmpp_conn_t *conn, xmpp_stanza_t *stanza,
- void *userdata) {
+static int message_handler(xmpp_conn_t* conn, xmpp_stanza_t* stanza,
+ void* userdata) {
xmpp_stanza_t* body = xmpp_stanza_get_child_by_name(stanza, "body");
if (body == NULL) {
@@ -51,6 +51,8 @@ static int message_handler(xmpp_conn_t *conn, xmpp_stanza_t *stanza,
data_add_incoming_message(sender, content);
+ xmpp_free(ctx, (void*)content);
+
return 1;
}