Hello, the attached patch fixes what I think is a memory leak and an incorrect call to free() (the message provided by pidgin was allocated by g_strdup() and should be freed by g_free()).
Greetings Andreas
>From 6b2de2a56346ce41b113e723a45afaa1f1d291a1 Mon Sep 17 00:00:00 2001 From: Andreas Schlick <[email protected]> Date: Sun, 16 Dec 2012 22:45:03 +0100 Subject: [PATCH] Fix memory leak and incorrect call to free(). --- otr-plugin.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/otr-plugin.c b/otr-plugin.c index d455ca8..ebd0fc9 100644 --- a/otr-plugin.c +++ b/otr-plugin.c @@ -718,12 +718,12 @@ static void process_sending_im(PurpleAccount *account, char *who, &newmessage, OTRL_FRAGMENT_SEND_ALL_BUT_LAST, NULL, NULL, NULL); if (err) { - /* Do not send out plain text */ - char *ourm = strdup(""); - free(*message); - *message = ourm; + /* Do not send out plain text */ + g_free(*message); + *message = g_strdup(""); } else if (newmessage) { - *message = strdup(newmessage); + g_free(*message); + *message = g_strdup(newmessage); } otrl_message_free(newmessage); -- 1.8.0.2
_______________________________________________ OTR-dev mailing list [email protected] http://lists.cypherpunks.ca/mailman/listinfo/otr-dev
