mirror of
https://git.jabber.space/devs/cproof.git
synced 2026-07-27 08:36:20 +00:00
Fix memory leak in roster_update()
current_name should not be const and should be freed.
This commit is contained in:
@@ -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) {
|
||||||
|
|||||||
Reference in New Issue
Block a user