Skip to content

Commit

Permalink
pua_reginfo: fix memory leak when usrloc is DB_ONLY
Browse files Browse the repository at this point in the history
As release_urecord() clearly says:

/*!
 * \brief Release urecord previously obtained through get_urecord
 * \warning Failing to calls this function after get_urecord will
 * result in a memory leak when the DB_ONLY mode is used. When
 * the records is later deleted, e.g. with delete_urecord, then
 * its not necessary, as this function already releases the record.
 * \param _r released record
 */

(cherry picked from commit 1b0e1c3)
  • Loading branch information
linuxmaniac committed Feb 22, 2017
1 parent 4844fac commit 36814fa
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion modules/pua_reginfo/notify.c
Expand Up @@ -458,7 +458,7 @@ int process_body(str notify_body, udomain_t * domain) {
}
}
next_registration:
// if (ul_record) ul.release_urecord(ul_record);
if (ul_record) ul.release_urecord(ul_record);
/* Unlock the domain for this AOR: */
if (aor_key.len > 0)
ul.unlock_udomain(domain, &aor_key);
Expand Down
3 changes: 2 additions & 1 deletion modules/pua_reginfo/usrloc_cb.c
Expand Up @@ -223,7 +223,7 @@ void reginfo_usrloc_cb(ucontact_t* c, int type, void* param) {
publ_info_t publ;
str content_type;
udomain_t * domain;
urecord_t * record;
urecord_t * record = NULL;
int res;
str uri = {NULL, 0};
str user = {NULL, 0};
Expand Down Expand Up @@ -332,6 +332,7 @@ void reginfo_usrloc_cb(ucontact_t* c, int type, void* param) {
if(body->s) xmlFree(body->s);
pkg_free(body);
}
if(record) ul.release_urecord(record);

return;
}

0 comments on commit 36814fa

Please sign in to comment.