[Pkg-privacy-commits] [libotr] 195/225: Fix: possible memory leak in otrl_message_sending

Ximin Luo infinity0 at moszumanska.debian.org
Sat Aug 22 12:45:31 UTC 2015


This is an automated email from the git hooks/post-receive script.

infinity0 pushed a commit to branch master
in repository libotr.

commit 54e84dfffc19d6561fe399d5a965fb576dd260da
Author: David Goulet <dgoulet at ev0ke.net>
Date:   Mon Oct 13 13:28:44 2014 -0400

    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 c87b3fe65)
    
    Fixes #25
    
    Reported-by: b42 <b42 at srck.net>
    Signed-off-by: David Goulet <dgoulet at ev0ke.net>
    Signed-off-by: Ian Goldberg <iang at cs.uwaterloo.ca>
---
 src/message.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/src/message.c b/src/message.c
index fe6957c..747e656 100644
--- a/src/message.c
+++ b/src/message.c
@@ -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. */
+		    free(*messagep);
+		    *messagep = rmessagep;
+		}
 	    }
 	}
 	return err;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-privacy/packages/libotr.git



More information about the Pkg-privacy-commits mailing list