Commit 54e84dff authored by David Goulet's avatar David Goulet Committed by Ian Goldberg
Browse files

Fix: possible memory leak in otrl_message_sending

Make sure we free the old messagep value if the fragment_and_send call
successfully sets it to a new value.

(Repairs a problem introduced in c87b3fe6


Fixes #25
Reported-by: MartinMilata's avatarb42 <>
Signed-off-by: default avatarDavid Goulet <>
Signed-off-by: default avatarIan Goldberg <>
parent 6e5c3d9e
......@@ -441,8 +441,15 @@ fragment:
/* Fragment and send according to policy */
if (!err && messagep && *messagep) {
if (context) {
char *rmessagep = NULL;
err = fragment_and_send(ops, opdata, context, *messagep,
fragPolicy, messagep);
fragPolicy, &rmessagep);
if (rmessagep) {
/* Free the current message pointer and return back the
* returned fragmented one. */
*messagep = rmessagep;
return err;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment