Some minor improvements

* destroy/free/shutdown/close in reverse order of allocation
* more static/auto_Xfree
* less variables/strlen/GString
* properly `\0`-terminate string of testcase

Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
This commit is contained in:
Steffen Jaeckel
2025-03-07 11:51:30 +01:00
parent b55bf6e4bd
commit 72b99ceb6d
9 changed files with 21 additions and 32 deletions

View File

@@ -69,8 +69,8 @@ static void
_chat_session_free(ChatSession* session)
{
if (session) {
free(session->barejid);
free(session->resource);
free(session->barejid);
free(session);
}
}

View File

@@ -2571,7 +2571,8 @@ iq_send_stanza(xmpp_stanza_t* const stanza)
if (plugin_text) {
xmpp_send_raw_string(conn, "%s", plugin_text);
} else {
xmpp_send_raw_string(conn, "%s", text);
/* libstrophe does the strlen for us, so simply always pass SIZE_MAX */
xmpp_send_raw(conn, text, SIZE_MAX);
}
xmpp_free(connection_get_ctx(), text);
}