about summary refs log tree commit diff stats
path: root/src/xmpp
diff options
context:
space:
mode:
authorJohn Hernandez <129467592+H3rnand3zzz@users.noreply.github.com>2023-04-10 16:21:23 +0200
committerJohn Hernandez <129467592+H3rnand3zzz@users.noreply.github.com>2023-04-10 21:26:10 +0200
commit2e43b0ae62478bede34f6f52f73d22d671425f85 (patch)
treec7d15b4da18e3d00a0084ca579f57c23d448df3f /src/xmpp
parent54cf152130fe7829740a20780533ca2c8d957135 (diff)
downloadprofani-tty-2e43b0ae62478bede34f6f52f73d22d671425f85.tar.gz
Fix releases of os and os_txt stanzas
If custom client is not set and include_os is true,
stanzas might be released without initializiting.

This commit fixes it by introducing an additional check
on usage of custom client.

Related to commit e52ca2fbaa02acec3b2b757369ef5740e7a103da
Diffstat (limited to 'src/xmpp')
-rw-r--r--src/xmpp/iq.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/xmpp/iq.c b/src/xmpp/iq.c
index e48d187a..1faa5b7f 100644
--- a/src/xmpp/iq.c
+++ b/src/xmpp/iq.c
@@ -1697,8 +1697,7 @@ _version_get_handler(xmpp_stanza_t* const stanza)
             xmpp_stanza_add_child(os, os_txt);
             xmpp_stanza_add_child(query, os);
         }
-    }
-    if (is_custom_client && custom_version_str != NULL) {
+    } else if (custom_version_str != NULL) {
         xmpp_stanza_set_text(version_txt, custom_version_str);
         xmpp_stanza_add_child(version, version_txt);
         xmpp_stanza_add_child(query, version);
@@ -1711,7 +1710,7 @@ _version_get_handler(xmpp_stanza_t* const stanza)
     g_string_free(version_str, TRUE);
     xmpp_stanza_release(version_txt);
     xmpp_stanza_release(name_txt);
-    if (include_os) {
+    if (!is_custom_client && include_os) {
         xmpp_stanza_release(os_txt);
         xmpp_stanza_release(os);
     }