mirror of
https://github.com/profanity-im/profanity.git
synced 2024-11-03 19:37:16 -05:00
Fix memory leak in roster_update()
current_name should not be const and should be freed.
This commit is contained in:
parent
e540ccd50e
commit
41267ae1c5
@ -304,13 +304,14 @@ roster_update(const char *const barejid, const char *const name, GSList *groups,
|
|||||||
p_contact_set_pending_out(contact, pending_out);
|
p_contact_set_pending_out(contact, pending_out);
|
||||||
|
|
||||||
const char * const new_name = name;
|
const char * const new_name = name;
|
||||||
const char * current_name = NULL;
|
char * current_name = NULL;
|
||||||
if (p_contact_name(contact)) {
|
if (p_contact_name(contact)) {
|
||||||
current_name = strdup(p_contact_name(contact));
|
current_name = strdup(p_contact_name(contact));
|
||||||
}
|
}
|
||||||
|
|
||||||
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);
|
||||||
|
|
||||||
GSList *curr_new_group = groups;
|
GSList *curr_new_group = groups;
|
||||||
while (curr_new_group) {
|
while (curr_new_group) {
|
||||||
|
Loading…
Reference in New Issue
Block a user