1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-06-09 21:30:42 +00:00

Fix double-free of values.

The strings have to be dup'ed, otherwise we'll free them twice.

Fixes #1855

Introduced by b6bb50ceb2

Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
This commit is contained in:
Steffen Jaeckel 2023-06-04 13:39:03 +02:00
parent 14a2dfc711
commit 88d383b052

View File

@ -2798,6 +2798,12 @@ _mam_rsm_id_handler(xmpp_stanza_t* const stanza, void* const userdata)
MamRsmUserdata* ndata = malloc(sizeof(*ndata));
*ndata = *data;
if (data->end_datestr)
ndata->end_datestr = strdup(data->end_datestr);
if (data->start_datestr)
ndata->start_datestr = strdup(data->start_datestr);
if (data->barejid)
ndata->barejid = strdup(data->barejid);
iq_id_handler_add(xmpp_stanza_get_id(iq), _mam_rsm_id_handler, (ProfIqFreeCallback)_mam_userdata_free, ndata);
iq_send_stanza(iq);