[sr-dev] [kamailio/kamailio] ndb_redis: Fix leaks from PV parsing (#2536)
weili-jiang
notifications at github.com
Thu Oct 29 06:21:12 CET 2020
- Add missing pkg_free for the dynamic PV name created during PV parsing
- Add missing pkg_free for any GPARAM_TYPE_PVS created during PV parsing
#### Pre-Submission Checklist
- [x] Commit message has the format required by CONTRIBUTING guide
- [x] Commits are split per component (core, individual modules, libs, utils, ...)
- [x] Each component has a single commit (if not, squash them into one commit)
- [x] No commits to README files for modules (changes must be done to docbook files
in `doc/` subfolder, the README file is autogenerated)
#### Type Of Change
- [ ] Small bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds new functionality)
- [ ] Breaking change (fix or feature that would change existing functionality)
#### Checklist:
- [ ] PR should be backported to stable branches
- [ ] Tested changes locally
- [ ] Related to issue #XXXX (replace XXXX with an open issue number)
#### Description
We are using NDB_REDIS in anger, fetching data from changing hash structures. NDB_REDIS creates dynamic PVs, and in order to do so it has a custom parser that allocates a dynamic PV structure as well as potentially multiple nested parameter structures. We very quickly found that we were running out of package memory, and enabling Kamailio's own memory debug logging quickly revealed that every `$redis(...)` query was leaking.
It appears that the allocated structures are only used within the subsequent handler to fetch the data. Therefore, to resolve the leak, the allocated structures are freed after the data for the PV in question has been fetched.
You can view, comment on, or merge this pull request online at:
https://github.com/kamailio/kamailio/pull/2536
-- Commit Summary --
* ndb_redis: Fix leaks from PV parsing
-- File Changes --
M src/modules/ndb_redis/ndb_redis_mod.c (24)
-- Patch Links --
https://github.com/kamailio/kamailio/pull/2536.patch
https://github.com/kamailio/kamailio/pull/2536.diff
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/2536
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-dev/attachments/20201028/cfa35d9d/attachment.htm>
More information about the sr-dev
mailing list