Module: kamailio
Branch: 5.2
Commit: 9fc7c9a1ee97e708247e050988eabf8b529c5fb2
URL:
https://github.com/kamailio/kamailio/commit/9fc7c9a1ee97e708247e050988eabf8…
Author: Victor Seva <linuxmaniac(a)torreviejawireless.org>
Committer: Victor Seva <linuxmaniac(a)torreviejawireless.org>
Date: 2019-10-07T23:10:19+02:00
usrloc: keep a private copy of urecord before running ul_callbacks
fixes #2089
(cherry picked from commit f3cf0a2f4e60a3a7185baa106869dab85cd8cd0b)
---
Modified: src/modules/usrloc/udomain.c
---
Diff:
https://github.com/kamailio/kamailio/commit/9fc7c9a1ee97e708247e050988eabf8…
Patch:
https://github.com/kamailio/kamailio/commit/9fc7c9a1ee97e708247e050988eabf8…
---
diff --git a/src/modules/usrloc/udomain.c b/src/modules/usrloc/udomain.c
index d451057bdd..80980c4cdf 100644
--- a/src/modules/usrloc/udomain.c
+++ b/src/modules/usrloc/udomain.c
@@ -907,7 +907,7 @@ int udomain_contact_expired_cb(db1_con_t* _c, udomain_t* _d)
str user, contact;
int i;
int n;
- urecord_t* r;
+ urecord_t r;
ucontact_t* c;
#define RUIDBUF_SIZE 128
char ruidbuf[RUIDBUF_SIZE];
@@ -1013,12 +1013,16 @@ int udomain_contact_expired_cb(db1_con_t* _c, udomain_t* _d)
}
lock_udomain(_d, &user);
- get_static_urecord(_d, &user, &r);
+ /* don't use the same static value from get_static_urecord() */
+ memset( &r, 0, sizeof(struct urecord) );
+ r.aor = user;
+ r.aorhash = ul_get_aorhash(&user);
+ r.domain = _d->name;
- if ( (c=mem_insert_ucontact(r, &contact, ci)) == 0) {
+ if ( (c=mem_insert_ucontact(&r, &contact, ci)) == 0) {
LM_ERR("inserting temporary contact failed for %.*s\n",
user.len, user.s);
- release_urecord(r);
+ release_urecord(&r);
unlock_udomain(_d, &user);
goto error;
}
@@ -1041,7 +1045,7 @@ int udomain_contact_expired_cb(db1_con_t* _c, udomain_t* _d)
user.len, user.s);
}
}
- release_urecord(r);
+ release_urecord(&r);
unlock_udomain(_d, &user);
if(ruid.len > 0 && ul_xavp_contact_name.s != NULL) {
/* delete attributes by ruid */