about summary refs log tree commit diff stats
path: root/src/xmpp
diff options
context:
space:
mode:
authorMichael Vetter <jubalh@iodoru.org>2019-07-22 14:42:43 +0200
committerMichael Vetter <jubalh@iodoru.org>2019-07-22 14:42:43 +0200
commit41267ae1c506310ff2f402ed0fefe98f91af8b59 (patch)
tree6f63df7d903f16165034d3d7db668a009d958768 /src/xmpp
parente540ccd50ee8d8b1a8e58049caa35bdb0e9da74f (diff)
downloadprofani-tty-41267ae1c506310ff2f402ed0fefe98f91af8b59.tar.gz
Fix memory leak in roster_update()
current_name should not be const and should be freed.
Diffstat (limited to 'src/xmpp')
-rw-r--r--src/xmpp/roster_list.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/xmpp/roster_list.c b/src/xmpp/roster_list.c
index 88c3ec0f..4df7d865 100644
--- a/src/xmpp/roster_list.c
+++ b/src/xmpp/roster_list.c
@@ -304,13 +304,14 @@ roster_update(const char *const barejid, const char *const name, GSList *groups,
     p_contact_set_pending_out(contact, pending_out);
 
     const char * const new_name = name;
-    const char * current_name = NULL;
+    char * current_name = NULL;
     if (p_contact_name(contact)) {
         current_name = strdup(p_contact_name(contact));
     }
 
     p_contact_set_name(contact, new_name);
     _replace_name(current_name, new_name, barejid);
+    free(current_name);
 
     GSList *curr_new_group = groups;
     while (curr_new_group) {