about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorSteffen Jaeckel <jaeckel-floss@eyet-services.de>2023-06-04 13:39:03 +0200
committerSteffen Jaeckel <jaeckel-floss@eyet-services.de>2023-06-04 13:39:03 +0200
commit88d383b052cb7f6e8afcd15dc8043bb683f8a687 (patch)
tree26d6b595ec75e72d5dacb2acf31a7e2734090e40 /src
parent14a2dfc711ba1c4cc3e0937162af86b68be86ade (diff)
downloadprofani-tty-88d383b052cb7f6e8afcd15dc8043bb683f8a687.tar.gz
Fix double-free of values.
The strings have to be dup'ed, otherwise we'll free them twice.

Fixes #1855

Introduced by b6bb50ceb28250317351fd5115e3f187f0c56fba

Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
Diffstat (limited to 'src')
-rw-r--r--src/xmpp/iq.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/xmpp/iq.c b/src/xmpp/iq.c
index f56e78e6..159ba609 100644
--- a/src/xmpp/iq.c
+++ b/src/xmpp/iq.c
@@ -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);