1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-12-04 14:46:46 -05:00

Fix memory leak in roster_update()

current_name should not be const and should be freed.
This commit is contained in:
Michael Vetter 2019-07-22 14:42:43 +02:00
parent e540ccd50e
commit 41267ae1c5

View File

@ -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) {