From 5f477b4e58e4d9b02aa20176c314b2915ff832f5 Mon Sep 17 00:00:00 2001 From: Victor Seva Date: Thu, 3 Oct 2019 14:21:35 +0200 Subject: [PATCH] usrloc: keep a private copy of urecord before running ul_callbacks fixes #2089 (cherry picked from commit f3cf0a2f4e60a3a7185baa106869dab85cd8cd0b) --- src/modules/usrloc/udomain.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/modules/usrloc/udomain.c b/src/modules/usrloc/udomain.c index d451057bddd..80980c4cdfd 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 */