1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-11-03 19:37:16 -05:00

Fix memleak in roster_change_name()

This commit is contained in:
Michael Vetter 2019-07-22 15:37:41 +02:00
parent 41b54a5c14
commit 9f0a40819f

View File

@ -232,10 +232,9 @@ void
roster_change_name(PContact contact, const char *const new_name) roster_change_name(PContact contact, const char *const new_name)
{ {
assert(roster != NULL); assert(roster != NULL);
assert(contact != NULL); assert(contact != NULL);
const char *current_name = NULL; char *current_name = NULL;
const char *barejid = p_contact_barejid(contact); const char *barejid = p_contact_barejid(contact);
if (p_contact_name(contact)) { if (p_contact_name(contact)) {
@ -244,6 +243,7 @@ roster_change_name(PContact contact, const char *const new_name)
p_contact_set_name(contact, new_name); p_contact_set_name(contact, new_name);
_replace_name(current_name, new_name, barejid); _replace_name(current_name, new_name, barejid);
free(current_name);
} }
void void