1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-11-03 19:37:16 -05:00

Free stanza text on plugin send hooks

This commit is contained in:
James Booth 2016-05-01 23:41:57 +01:00
parent 6df6fed305
commit 2bacd43a16
3 changed files with 3 additions and 0 deletions

View File

@ -2071,6 +2071,7 @@ send_iq_stanza(xmpp_stanza_t *const stanza)
char *plugin_text = plugins_on_iq_stanza_send(text); char *plugin_text = plugins_on_iq_stanza_send(text);
if (plugin_text) { if (plugin_text) {
xmpp_send_raw_string(conn, "%s", plugin_text); xmpp_send_raw_string(conn, "%s", plugin_text);
free(plugin_text);
} else { } else {
xmpp_send_raw_string(conn, "%s", text); xmpp_send_raw_string(conn, "%s", text);
} }

View File

@ -872,6 +872,7 @@ _send_message_stanza(xmpp_stanza_t *const stanza)
char *plugin_text = plugins_on_message_stanza_send(text); char *plugin_text = plugins_on_message_stanza_send(text);
if (plugin_text) { if (plugin_text) {
xmpp_send_raw_string(conn, "%s", plugin_text); xmpp_send_raw_string(conn, "%s", plugin_text);
free(plugin_text);
} else { } else {
xmpp_send_raw_string(conn, "%s", text); xmpp_send_raw_string(conn, "%s", text);
} }

View File

@ -841,6 +841,7 @@ _send_presence_stanza(xmpp_stanza_t *const stanza)
char *plugin_text = plugins_on_presence_stanza_send(text); char *plugin_text = plugins_on_presence_stanza_send(text);
if (plugin_text) { if (plugin_text) {
xmpp_send_raw_string(conn, "%s", plugin_text); xmpp_send_raw_string(conn, "%s", plugin_text);
free(plugin_text);
} else { } else {
xmpp_send_raw_string(conn, "%s", text); xmpp_send_raw_string(conn, "%s", text);
} }