Module: kamailio
Branch: master
Commit: 2dc19e5c78977416c15ebe93a4f4e6d72ed475a0
URL:
https://github.com/kamailio/kamailio/commit/2dc19e5c78977416c15ebe93a4f4e6d…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2017-07-20T09:31:49+02:00
tls: free temporary buffer when fixing shm path name for config
---
Modified: src/modules/tls/tls_domain.c
---
Diff:
https://github.com/kamailio/kamailio/commit/2dc19e5c78977416c15ebe93a4f4e6d…
Patch:
https://github.com/kamailio/kamailio/commit/2dc19e5c78977416c15ebe93a4f4e6d…
---
diff --git a/src/modules/tls/tls_domain.c b/src/modules/tls/tls_domain.c
index e65d01a598..a56c76e2b3 100644
--- a/src/modules/tls/tls_domain.c
+++ b/src/modules/tls/tls_domain.c
@@ -480,16 +480,25 @@ static int tls_foreach_CTX_in_cfg(tls_domains_cfg_t* cfg,
int fix_shm_pathname(str* path)
{
str new_path;
- char* abs_path;
-
- if (path->s && path->len && *path->s != '.' &&
*path->s != '/') {
+ char *abs_path;
+
+ if(path->s && path->len && *path->s != '.' &&
*path->s != '/') {
abs_path = get_abs_pathname(0, path);
- if (abs_path == 0) return -1;
+ if(abs_path == 0) {
+ LM_ERR("get abs pathname failed\n");
+ return -1;
+ }
new_path.len = strlen(abs_path);
new_path.s = shm_malloc(new_path.len + 1);
+ if(new_path.s == 0) {
+ LM_ERR("no more shm memory\n");
+ pkg_free(abs_path);
+ return -1;
+ }
memcpy(new_path.s, abs_path, new_path.len);
new_path.s[new_path.len] = 0;
shm_free(path->s);
+ pkg_free(abs_path);
*path = new_path;
}
return 0;