1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-12-04 14:46:46 -05:00

Fix use-after-free

introduced in 8d3c1f79ac

This fixes #1852

Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
This commit is contained in:
Steffen Jaeckel 2023-05-21 11:02:14 +02:00
parent c0861eed49
commit b6bb50ceb2

View File

@ -2796,7 +2796,9 @@ _mam_rsm_id_handler(xmpp_stanza_t* const stanza, void* const userdata)
xmpp_stanza_t* iq = stanza_create_mam_iq(ctx, data->barejid, data->start_datestr, NULL, firstid, NULL);
free(firstid);
iq_id_handler_add(xmpp_stanza_get_id(iq), _mam_rsm_id_handler, (ProfIqFreeCallback)_mam_userdata_free, data);
MamRsmUserdata* ndata = malloc(sizeof(*ndata));
*ndata = *data;
iq_id_handler_add(xmpp_stanza_get_id(iq), _mam_rsm_id_handler, (ProfIqFreeCallback)_mam_userdata_free, ndata);
iq_send_stanza(iq);
xmpp_stanza_release(iq);