[sr-dev] git:master: geoip: free allocated pointers at startup in case of error

Daniel-Constantin Mierla miconda at gmail.com
Mon Jun 30 12:12:38 CEST 2014


Module: sip-router
Branch: master
Commit: 5db25855613f922059b53d7149e97b4985120de0
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=5db25855613f922059b53d7149e97b4985120de0

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date:   Mon Jun 30 12:11:45 2014 +0200

geoip: free allocated pointers at startup in case of error

- cleaner shut down

---

 modules/geoip/geoip_pv.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/modules/geoip/geoip_pv.c b/modules/geoip/geoip_pv.c
index 6a18461..d2aaf7c 100644
--- a/modules/geoip/geoip_pv.c
+++ b/modules/geoip/geoip_pv.c
@@ -107,6 +107,7 @@ sr_geoip_item_t *sr_geoip_add_item(str *name)
 	if(it->pvclass.s==NULL)
 	{
 		LM_ERR("no more pkg.\n");
+		pkg_free(it);
 		return NULL;
 	}
 	memcpy(it->pvclass.s, name->s, name->len);
@@ -220,6 +221,9 @@ int pv_parse_geoip_name(pv_spec_p sp, str *in)
 	return 0;
 
 error:
+	if(gpv!=NULL)
+		pkg_free(gpv);
+
 	LM_ERR("error at PV geoip name: %.*s\n", in->len, in->s);
 	return -1;
 }




More information about the sr-dev mailing list