- Allocated buffer is not freed when contact fetch is failed
- Leak frequently occurs when database disconnects and reconnects
<!-- Kamailio Pull Request Template -->
<!--
IMPORTANT:
- for detailed contributing guidelines, read:
https://github.com/kamailio/kamailio/blob/master/.github/CONTRIBUTING.md
- pull requests must be done to master branch, unless they are backports
of fixes from master branch to a stable branch
- backports to stable branches must be done with 'git cherry-pick -x ...'
- code is contributed under BSD for core and main components (tm, sl, auth, tls)
- code is contributed GPLv2 or a compatible license for the other components
- GPL code is contributed with OpenSSL licensing exception
-->
#### Pre-Submission Checklist
<!-- Go over all points below, and after creating the PR, tick all the checkboxes that apply -->
<!-- All points should be verified, otherwise, read the CONTRIBUTING guidelines from above-->
<!-- If you're unsure about any of these, don't hesitate to ask on sr-dev mailing list -->
- [ ] Commit message has the format required by CONTRIBUTING guide
- [ ] Commits are split per component (core, individual modules, libs, utils, ...)
- [ ] 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
- [x] 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:
<!-- Go over all points below, and after creating the PR, tick the checkboxes that apply -->
- [ ] PR should be backported to stable branches
- [x] Tested changes locally
- [ ] Related to issue #XXXX (replace XXXX with an open issue number)
#### Description
<!-- Describe your changes in detail -->
Found the leak during stress test and intentionally disconnecting database access
You can view, comment on, or merge this pull request online at:
https://github.com/kamailio/kamailio/pull/2062
-- Commit Summary --
* nathelper: Fixed memory leak
-- File Changes --
M src/modules/nathelper/nathelper.c (2)
-- Patch Links --
https://github.com/kamailio/kamailio/pull/2062.patchhttps://github.com/kamailio/kamailio/pull/2062.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/2062
### Description
If in kamailio.cfg I write IPv6 address for Database URL like this:
```
#!ifndef DBURL
#!define DBURL "mysql://kamailio:kamailiorw@[2001:5c8:4e00:11:a213:ba2d:579a:3e3d]/kamailio"
#!endif
```
Then kamailio can't connect to database.
#### Reproduction
Just try to use database server with IPv6-address in kamailio.cfg
#### Log Messages
```
Sep 8 14:35:40 c7-01 /sbin/kamailio[10680]: ERROR: db_mysql [km_my_con.c:139]: db_mysql_new_connection(): driver error: Unknown MySQL server host '[2001' (2)
Sep 8 14:35:40 c7-01 /sbin/kamailio[10680]: ERROR: <core> [db.c:319]: db_do_init2(): could not add connection to the pool
Sep 8 14:35:40 c7-01 /sbin/kamailio[10680]: ERROR: usrloc [dlist.c:646]: register_udomain(): failed to open database connection
```
### Possible Solutions
Correct parsing of config file.
### Additional Information
```
version: kamailio 5.3.0-dev7 (x86_64/linux)
flags: USE_TCP, USE_TLS, USE_SCTP, TLS_HOOKS, USE_RAW_SOCKS, DISABLE_NAGLE, USE_MCAST, DNS_IP_HACK, SHM_MMAP, PKG_MALLOC, Q_MALLOC, F_MALLOC, TLSF_MALLOC, DBG_SR_MEMORY, USE_FUTEX, FAST_LOCK-ADAPTIVE_WAIT, USE_DNS_CACHE, USE_DNS_FAILOVER, USE_NAPTR, USE_DST_BLACKLIST, HAVE_RESOLV_RES
ADAPTIVE_WAIT_LOOPS 1024, MAX_RECV_BUFFER_SIZE 262144, MAX_URI_SIZE 1024, BUF_SIZE 65535, DEFAULT PKG_SIZE 8MB
poll method support: poll, epoll_lt, epoll_et, sigio_rt, select.
```
* **Operating System**:
CentOS 7
```
Linux sip.aaa.de 3.10.0-957.27.2.el7.x86_64 #1 SMP Mon Jul 29 17:46:05 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
```
--
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/issues/2060
#### Pre-Submission Checklist
<!-- Go over all points below, and after creating the PR, tick all the checkboxes that apply -->
<!-- All points should be verified, otherwise, read the CONTRIBUTING guidelines from above-->
<!-- If you're unsure about any of these, don't hesitate to ask on sr-dev mailing list -->
- [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
- [x] 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:
- [x] PR should be backported to stable branches
- [x] Tested changes locally
- [x] Related to issue #2060
#### Description
Added parsing of IPv6 address in config file for DB URL.
You can view, comment on, or merge this pull request online at:
https://github.com/kamailio/kamailio/pull/2061
-- Commit Summary --
* lib: database URL supports IPv6 address as hostname
* db_mysql: database URL supports IPv6 address as hostname
* db_postgres: database URL supports IPv6 address as hostname
-- File Changes --
M src/lib/srdb1/db_id.c (26)
M src/modules/db_mysql/my_uri.c (26)
M src/modules/db_postgres/pg_uri.c (26)
-- Patch Links --
https://github.com/kamailio/kamailio/pull/2061.patchhttps://github.com/kamailio/kamailio/pull/2061.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/2061