Browse code

geoip: free allocated pointers at startup in case of error

- cleaner shut down

(cherry picked from commit 5db25855613f922059b53d7149e97b4985120de0)

Daniel-Constantin Mierla authored on 30/06/2014 10:11:45
Showing 1 changed files
... ...
@@ -107,6 +107,7 @@ sr_geoip_item_t *sr_geoip_add_item(str *name)
107 107
 	if(it->pvclass.s==NULL)
108 108
 	{
109 109
 		LM_ERR("no more pkg.\n");
110
+		pkg_free(it);
110 111
 		return NULL;
111 112
 	}
112 113
 	memcpy(it->pvclass.s, name->s, name->len);
... ...
@@ -220,6 +221,9 @@ int pv_parse_geoip_name(pv_spec_p sp, str *in)
220 221
 	return 0;
221 222
 
222 223
 error:
224
+	if(gpv!=NULL)
225
+		pkg_free(gpv);
226
+
223 227
 	LM_ERR("error at PV geoip name: %.*s\n", in->len, in->s);
224 228
 	return -1;
225 229
 }