diff options
author | Michael Vetter <jubalh@iodoru.org> | 2020-04-21 17:11:04 +0200 |
---|---|---|
committer | Michael Vetter <jubalh@iodoru.org> | 2020-04-21 17:11:04 +0200 |
commit | 5ec1b03cbc838a1102407b01a18f2fa1e4b6ca64 (patch) | |
tree | 11efaa5583b565a6a966bec29210a80e5558841a /src/xmpp | |
parent | 813fd637a1e76f11daa488ee568059e4ddff35fb (diff) | |
download | profani-tty-5ec1b03cbc838a1102407b01a18f2fa1e4b6ca64.tar.gz |
_handle_carbons(): fix potential memleak
Diffstat (limited to 'src/xmpp')
-rw-r--r-- | src/xmpp/message.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/xmpp/message.c b/src/xmpp/message.c index d8d12a74..c9972621 100644 --- a/src/xmpp/message.c +++ b/src/xmpp/message.c @@ -1114,8 +1114,6 @@ _handle_carbons(xmpp_stanza_t *const stanza) } #endif - message->body = xmpp_message_get_body(message_stanza); - const gchar *to = xmpp_stanza_get_to(message_stanza); const gchar *from = xmpp_stanza_get_from(message_stanza); @@ -1125,8 +1123,12 @@ _handle_carbons(xmpp_stanza_t *const stanza) Jid *jid_from = jid_create(from); Jid *jid_to = jid_create(to); + message->body = xmpp_message_get_body(message_stanza); + if (!message->plain && !message->body) { log_error("Message received without body from: %s", jid_from->fulljid); + jid_destroy(jid_from); + jid_destroy(jid_to); goto out; } else if (!message->plain) { message->plain = strdup(message->body); |