Module: kamailio
Branch: master
Commit: 0aa7571afe5c25bfffaf865595181470ac78f4d2
URL:
https://github.com/kamailio/kamailio/commit/0aa7571afe5c25bfffaf86559518147…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2017-07-04T09:00:45+02:00
core: proxy - free in case of errors making proxy only from ip
---
Modified: src/core/proxy.c
---
Diff:
https://github.com/kamailio/kamailio/commit/0aa7571afe5c25bfffaf86559518147…
Patch:
https://github.com/kamailio/kamailio/commit/0aa7571afe5c25bfffaf86559518147…
---
diff --git a/src/core/proxy.c b/src/core/proxy.c
index 78e74da3a6..06e400b0b1 100644
--- a/src/core/proxy.c
+++ b/src/core/proxy.c
@@ -290,11 +290,15 @@ struct proxy_l* mk_proxy_from_ip(struct ip_addr* ip, unsigned short
port,
p->host.h_addrtype=ip->af;
p->host.h_length=ip->len;
p->host.h_addr_list=pkg_malloc(2*sizeof(char*));
- if (p->host.h_addr_list==0) goto error;
+ if (p->host.h_addr_list==0) {
+ pkg_free(p);
+ goto error;
+ }
p->host.h_addr_list[1]=0;
p->host.h_addr_list[0]=pkg_malloc(ip->len+1);
if (p->host.h_addr_list[0]==0){
pkg_free(p->host.h_addr_list);
+ pkg_free(p);
goto error;
}