# HG changeset patch # User Mikael Berthe # Date 1165143617 -3600 # Node ID 866be086cc9bcf14f2e2710bc9ac5b278e6bf303 # Parent 9eaacc0ad3a2fcf313701e0b90ae13bd06b52090 Fix a memory leak in JEP22 handling diff -r 9eaacc0ad3a2 -r 866be086cc9b mcabber/src/jabglue.c --- a/mcabber/src/jabglue.c Sun Dec 03 11:59:42 2006 +0100 +++ b/mcabber/src/jabglue.c Sun Dec 03 12:00:17 2006 +0100 @@ -495,6 +495,7 @@ // new_msgid() // Generate a new id string. The caller should free it. +// The caller must free the string when no longer needed. static char *new_msgid(void) { static guint msg_idn; @@ -523,6 +524,9 @@ guint use_jep85 = 0; struct jep0085 *jep85 = NULL; #endif +#if defined JEP0022 + gchar *nmsgid = NULL; +#endif gchar *enc = NULL; if (encrypted) @@ -631,7 +635,7 @@ // An id is mandatory when using JEP-0022. if (!msgid && (text || subject)) { - msgid = new_msgid(); + msgid = nmsgid = new_msgid(); // Let's update last_msgid_sent // (We do not update it when the msgid is provided by the caller, // because this is probably a special message...) @@ -648,6 +652,9 @@ jab_send(jc, x); xmlnode_free(x); +#if defined JEP0022 + g_free(nmsgid); +#endif jb_reset_keepalive(); }