Module: kamailio
Branch: master
Commit: 5f3f499bc8f7ea0227b62494f73fbd734a820fa1
URL:
https://github.com/kamailio/kamailio/commit/5f3f499bc8f7ea0227b62494f73fbd7…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2015-11-20T12:33:19+01:00
dmq_usrloc: use system malloc for fetching all contacts
- this is a very rare operation, thus not making sense to allocate a lot
of pkg for it (the memory is freed immediately)
---
Modified: modules/dmq_usrloc/usrloc_sync.c
---
Diff:
https://github.com/kamailio/kamailio/commit/5f3f499bc8f7ea0227b62494f73fbd7…
Patch:
https://github.com/kamailio/kamailio/commit/5f3f499bc8f7ea0227b62494f73fbd7…
---
diff --git a/modules/dmq_usrloc/usrloc_sync.c b/modules/dmq_usrloc/usrloc_sync.c
index d1c534f..7752c3e 100644
--- a/modules/dmq_usrloc/usrloc_sync.c
+++ b/modules/dmq_usrloc/usrloc_sync.c
@@ -124,6 +124,9 @@ static int delete_contact(str aor, ucontact_info_t* ci)
return 0;
}
+#define dmq_usrloc_malloc malloc
+#define dmq_usrloc_free free
+
void usrloc_get_all_ucontact(dmq_node_t* node)
{
int rval, len=0;
@@ -161,16 +164,16 @@ void usrloc_get_all_ucontact(dmq_node_t* node)
}
if (rval > 0) {
if (buf != NULL)
- pkg_free(buf);
+ dmq_usrloc_free(buf);
len = rval * 2;
- buf = pkg_malloc(len);
+ buf = dmq_usrloc_malloc(len);
if (buf == NULL) {
LM_ERR("out of pkg memory\n");
goto done;
}
rval = dmq_ul.get_all_ucontacts(buf, len, 0, 0, 1, 0);
if (rval != 0) {
- pkg_free(buf);
+ dmq_usrloc_free(buf);
goto done;
}
}
@@ -216,7 +219,7 @@ void usrloc_get_all_ucontact(dmq_node_t* node)
dmq_ul.release_urecord(r);
dmq_ul.unlock_udomain(_d, &aor);
}
- pkg_free(buf);
+ dmq_usrloc_free(buf);
done:
c.s = ""; c.len = 0;