Browse code

Merge remote branch 'origin/sr_3.0'

Weekly update with the latest sr_3.0 fixes.

* origin/sr_3.0:
core: fix fixup_spve_* reuse after free
Remove obsolete gen_ha1.
modules_k/permissions: Increased version number of 'trusted' table
lib/srdb1/schema/trusted.xml: forgot to increase version number
lib/srdb1/schema/trusted.xml: increased tag length from 32 to 64 chars
makefile: support self-installing utils, extra cfgs a.s.o.
core: fix memleak in fixup_free*
core: fix cfg_update() on config error 2nd try
userblacklist(k): gcc 2.95 compile fixes
statistics(k): minor warning in printf fmt
siputils(k): gcc 2.95 compile fixes
registrar(k): gcc 2.95 compile fixes
pua_mi: gcc 2.95 compile fixes
cfgutils(k): gcc 2.95 compile fixes
lcr: compile & warning fixes for gcc 2.95
db_postgres: compile fixes for gcc 2.95
db_mysql: compile fix for gcc 2.95
compile: don't warn on old gcc versions
utils/sercmd: Fixed include paths also in sr_3.0 branch.

Conflicts:
Makefile

Andrei Pelinescu-Onciul authored on 15/10/2009 18:01:11
Showing 19 changed files
... ...
@@ -339,15 +339,27 @@ cmodules=$(foreach mods,$(modules_dirs), $($(mods)))
339 339
 #modules_full_path=$(join  $(modules), $(addprefix /, $(modules_names)))
340 340
 
341 341
 
342
-# which utils need compilation (directory path) and which to install
343
-# (full path including file name)
344
-utils_compile=	utils/sercmd
345
-utils_bin_install=	# sercmd is now installed by ctl
346
-utils_script_install=
347 342
 
348
-# This is the list of files to be installed into the arch-independent
349
-# shared directory (by default /usr/local/share/$(MAIN_NAME))
350
-share_install=
343
+# list of utils directories that should be compiled by make utils
344
+C_COMPILE_UTILS=	utils/sercmd
345
+# list of binaries that should be installed alongside
346
+# (they should be created after make utils, see C_COMPILE_UTILS)
347
+C_INSTALL_BIN=	# sercmd is now installed by ctl
348
+
349
+# which utils know to install themselves and should be installed
350
+# along the core (list of utils directories)
351
+C_INSTALL_UTILS=
352
+# list of scripts that should be installed along the core 
353
+# (here a script is something that doesn't have a Makefile)
354
+C_INSTALL_SCRIPTS=
355
+# list of extra configs that should be installed along the core
356
+# Note: all the paths of the form /usr/*lib/$(CFG_NAME)/<module_dir>
357
+# will be updated to the directory where the modules will be installed.
358
+C_INSTALL_CFGS=
359
+# list of files that should be installed in the arch-independent 
360
+# directory (by default /usr/local/share/$(MAIN_NAME)))
361
+C_INSTALL_SHARE=
362
+
351 363
 
352 364
 
353 365
 
... ...
@@ -635,7 +647,7 @@ $(extra_objs):
635 647
 
636 648
 .PHONY: utils
637 649
 utils:
638
-	@for r in $(utils_compile) "" ; do \
650
+	@for r in $(C_COMPILE_UTILS) "" ; do \
639 651
 		if [ -n "$$r" ]; then \
640 652
 			$(call oecho, "" ;) \
641 653
 			$(call oecho, "" ;) \
... ...
@@ -801,6 +813,30 @@ install-cfg: $(cfg_prefix)/$(cfg_dir)
801 813
 			mv -f $(cfg_prefix)/$(cfg_dir)$(MAIN_NAME)-advanced.cfg.sample \
802 814
 				$(cfg_prefix)/$(cfg_dir)$(MAIN_NAME)-advanced.cfg; \
803 815
 		fi
816
+		# other configs
817
+		@for r in $(C_INSTALL_CFGS) ; do \
818
+			if [ -n "$$r" ]; then \
819
+				if [ -f "$$r" ]; then \
820
+					n=`basename "$$r"` ; \
821
+					sed $(foreach m,$(modules_dirs),\
822
+							-e "s#/usr/[^:]*lib/$(CFG_NAME)/$(m)\([:/\"]\)#$($(m)_target)\1#g") \
823
+						< "$$r" \
824
+						> "$(cfg_prefix)/$(cfg_dir)$$n.sample" ; \
825
+					chmod 644 "$(cfg_prefix)/$(cfg_dir)$$n.sample" ; \
826
+					if [ -z "${skip_cfg_install}" -a \
827
+							! -f "$(cfg_prefix)/$(cfg_dir)$$n" ]; \
828
+					then \
829
+						mv -f "$(cfg_prefix)/$(cfg_dir)$$n.sample" \
830
+								"$(cfg_prefix)/$(cfg_dir)$$n"; \
831
+					fi ; \
832
+				else \
833
+					echo "ERROR: $$r not found" ; \
834
+					if [ ${err_fail} = 1 ] ; then \
835
+						exit 1; \
836
+					fi ; \
837
+				fi ; \
838
+			fi ; \
839
+		done; true
804 840
 		# radius dictionary
805 841
 		$(INSTALL_TOUCH) $(cfg_prefix)/$(cfg_dir)/dictionary.$(CFG_NAME)
806 842
 		$(INSTALL_CFG) etc/dictionary.$(CFG_NAME) $(cfg_prefix)/$(cfg_dir)
... ...
@@ -811,7 +847,7 @@ install-bin: $(bin_prefix)/$(bin_dir) $(NAME)
811 847
 
812 848
 
813 849
 install-share: $(share_prefix)/$(share_dir)
814
-	@for r in $(share_install) "" ; do \
850
+	@for r in $(C_INSTALL_SHARE) "" ; do \
815 851
 		if [ -n "$$r" ]; then \
816 852
 			if [ -f "$$r" ]; then \
817 853
 				$(call try_err, $(INSTALL_TOUCH) \
... ...
@@ -835,7 +871,7 @@ install-every-module-doc: $(foreach mods,$(modules_dirs),install-$(mods)-doc)
835 871
 install-every-module-man: $(foreach mods,$(modules_dirs),install-$(mods)-man)
836 872
 
837 873
 install-utils: utils $(bin_prefix)/$(bin_dir)
838
-	@for r in $(utils_bin_install) "" ; do \
874
+	@for r in $(C_INSTALL_BIN) "" ; do \
839 875
 		if [ -n "$$r" ]; then \
840 876
 			if [ -f "$$r" ]; then \
841 877
 				$(call try_err, $(INSTALL_TOUCH) \
... ...
@@ -850,7 +886,7 @@ install-utils: utils $(bin_prefix)/$(bin_dir)
850 886
 			fi ;\
851 887
 		fi ; \
852 888
 	done; true
853
-	@for r in $(utils_script_install) "" ; do \
889
+	@for r in $(C_INSTALL_SCRIPTS) "" ; do \
854 890
 		if [ -n "$$r" ]; then \
855 891
 			if [ -f "$$r" ]; then \
856 892
 				$(call try_err, $(INSTALL_TOUCH) \
... ...
@@ -865,6 +901,9 @@ install-utils: utils $(bin_prefix)/$(bin_dir)
865 901
 			fi ;\
866 902
 		fi ; \
867 903
 	done; true
904
+	@for ut in $(C_INSTALL_UTILS) ; do \
905
+		$(call try_err, $(MAKE) -C "$${ut}" install-if-newer ) ;\
906
+	done; true
868 907
 
869 908
 
870 909
 install-modules-all: install-every-module install-every-module-doc
... ...
@@ -52,7 +52,7 @@
52 52
 
53 53
 #else /* __GNUC__ */
54 54
 
55
-#warning "No compiler optimizations supported try gcc 4.x"
55
+/* #warning "No compiler optimizations supported try gcc 4.x" */
56 56
 #define likely(expr) (expr)
57 57
 #define unlikely(expr) (expr)
58 58
 
... ...
@@ -9,7 +9,7 @@
9 9
 
10 10
 <table id="trusted" xmlns:db="http://docbook.org/ns/docbook">
11 11
     <name>trusted</name>
12
-    <version>4</version>
12
+    <version>5</version>
13 13
     <type db="mysql">&MYSQL_TABLE_TYPE;</type>
14 14
     <description>
15 15
         <db:para>This table is used by the permissions module to determine if a call has the appropriate permission to be established. More information about the permissions module can be found at: &KAMAILIO_MOD_DOC;permissions.html
... ...
@@ -53,7 +53,7 @@
53 53
     <column>
54 54
         <name>tag</name>
55 55
         <type>string</type>
56
-        <size>32</size>
56
+        <size>64</size>
57 57
         <null/>
58 58
         <description>Tag</description>
59 59
     </column>
... ...
@@ -1556,6 +1556,7 @@ int main_loop()
1556 1556
 #endif
1557 1557
 		/* init cfg, but without per child callbacks support */
1558 1558
 		cfg_child_no_cb_init();
1559
+		cfg_ok=1;
1559 1560
 
1560 1561
 #ifdef EXTRA_DEBUG
1561 1562
 		for (r=0; r<*process_count; r++){
... ...
@@ -2096,7 +2097,6 @@ try_again:
2096 2097
 		LOG(L_CRIT, "could not declare the core configuration\n");
2097 2098
 		goto error;
2098 2099
 	}
2099
-	cfg_ok=1;
2100 2100
 #ifdef USE_TCP
2101 2101
 	if (tcp_register_cfg()){
2102 2102
 		LOG(L_CRIT, "could not register the tcp configuration\n");
... ...
@@ -204,7 +204,6 @@ FIXUP_F2FP_T(igp_pvar_pvar, 1, 3, 1, FPARAM_INT|FPARAM_PVS, FPARAM_PVS)
204 204
 		int ret; \
205 205
 		char * bkp; \
206 206
 		fparam_t* fp; \
207
-		bkp=*param; \
208 207
 		if (param_no<=(no1)){ \
209 208
 			if ((ret=fix_param_types(FPARAM_PVE, param))<0){ \
210 209
 				ERR("Cannot convert function parameter %d to" #type2 "\n", \
... ...
@@ -213,6 +212,8 @@ FIXUP_F2FP_T(igp_pvar_pvar, 1, 3, 1, FPARAM_INT|FPARAM_PVS, FPARAM_PVS)
213 212
 			} else{ \
214 213
 				fp=(fparam_t*)*param; \
215 214
 				if ((ret==0) && (fp->v.pve->spec.getf==0)){ \
215
+					bkp=fp->orig; \
216
+					fp->orig=0; /* make sure orig string is not freed */ \
216 217
 					fparam_free_contents(fp); \
217 218
 					pkg_free(fp); \
218 219
 					*param=bkp; \
... ...
@@ -136,9 +136,10 @@ struct my_con* db_mysql_new_connection(const struct db_id* id)
136 136
  */
137 137
 void db_mysql_free_connection(struct pool_con* con)
138 138
 {
139
+	struct my_con * _c;
140
+	
139 141
 	if (!con) return;
140 142
 
141
-	struct my_con * _c;
142 143
 	_c = (struct my_con*) con;
143 144
 
144 145
 	if (_c->res) mysql_free_result(_c->res);
... ...
@@ -108,9 +108,10 @@ struct pg_con* db_postgres_new_connection(struct db_id* id)
108 108
 void db_postgres_free_connection(struct pool_con* con)
109 109
 {
110 110
 
111
+	struct pg_con * _c;
112
+	
111 113
 	if (!con) return;
112 114
 
113
-	struct pg_con * _c;
114 115
 	_c = (struct pg_con*)con;
115 116
 
116 117
 	if (_c->res) {
... ...
@@ -277,14 +277,13 @@ int pg_con_connect(db_con_t* con)
277 277
 	/* Override default notice processor */
278 278
 	PQsetNoticeProcessor(pcon->con, notice_processor, 0);
279 279
 	
280
-	DBG("postgres: Connected. Protocol version=%d, Server version=%d\n", 
281
-	    PQprotocolVersion(pcon->con),
282 280
 #ifdef HAVE_PGSERVERVERSION
283
-	    PQserverVersion(pcon->con)
281
+	DBG("postgres: Connected. Protocol version=%d, Server version=%d\n", 
282
+	    PQprotocolVersion(pcon->con), PQserverVersion(pcon->con));
284 283
 #else
285
-	    0
284
+	DBG("postgres: Connected. Protocol version=%d, Server version=%d\n", 
285
+	    PQprotocolVersion(pcon->con), 0 );
286 286
 #endif
287
-	    );
288 287
 
289 288
 	ret = timestamp_format(pcon->con);
290 289
 	if (ret == 1 || ret == -1) {
... ...
@@ -399,6 +399,7 @@ static int mod_init(void)
399 399
     str s;
400 400
     unsigned short avp_flags;
401 401
     unsigned int i;
402
+    db1_con_t* dbh;
402 403
 
403 404
 	if(register_mi_mod(exports.name, mi_cmds)!=0)
404 405
 	{
... ...
@@ -556,7 +557,6 @@ static int mod_init(void)
556 557
     }
557 558
 
558 559
     /* Check table version */
559
-    db1_con_t* dbh;
560 560
     if (lcr_dbf.init==0){
561 561
 	LM_CRIT("unbound database\n");
562 562
 	return -1;
... ...
@@ -1277,7 +1277,7 @@ int reload_gws_and_lcrs(int lcr_id)
1277 1277
 	    first_gw = find_first_gw(gw_grps, grp_cnt, grp_id);
1278 1278
 	    if (first_gw == 0) {
1279 1279
 		LM_ERR("gw grp_id <%u> of prefix <%.*s> has no gateways\n",
1280
-		       grp_id, prefix_len, prefix);
1280
+		       grp_id, (int)prefix_len, prefix);
1281 1281
 		goto lcr_err;
1282 1282
 	    }
1283 1283
 	    if ((VAL_NULL(ROW_VALUES(row) + 3) == 1) ||
... ...
@@ -1892,7 +1892,7 @@ static int generate_uris(char *r_uri, str *r_uri_user, unsigned int *r_uri_len,
1892 1892
     destroy_avp(gu_avp);
1893 1893
 	
1894 1894
     LM_DBG("r_uri <%.*s>, dst_uri <%.*s>\n",
1895
-	   *r_uri_len, r_uri, *dst_uri_len, dst_uri);
1895
+	   (int)*r_uri_len, r_uri, (int)*dst_uri_len, dst_uri);
1896 1896
 
1897 1897
     return 1;
1898 1898
 }
... ...
@@ -488,11 +488,6 @@ error:
488 488
   */
489 489
 static int MD5File(char *dest, const char *file_name)
490 490
 {
491
-	if (!dest || !file_name) {
492
-		LM_ERR("invalid parameter value\n");
493
-		return -1;
494
-	}
495
-
496 491
 	MD5_CTX context;
497 492
 	FILE *input;
498 493
 	unsigned char buffer[32768];
... ...
@@ -500,6 +495,12 @@ static int MD5File(char *dest, const char *file_name)
500 495
 	unsigned int counter, size;
501 496
 	
502 497
 	struct stat stats;
498
+	
499
+	if (!dest || !file_name) {
500
+		LM_ERR("invalid parameter value\n");
501
+		return -1;
502
+	}
503
+
503 504
     if (stat(file_name, &stats) != 0) {
504 505
 		LM_ERR("could not stat file %s\n", file_name);
505 506
 		return -1;
... ...
@@ -588,12 +589,13 @@ static int get_prob(struct sip_msg *bar, char *foo1, char *foo2)
588 589
 
589 590
 static int rand_event(struct sip_msg *bar, char *foo1, char *foo2)
590 591
 {
592
+	double tmp;
591 593
 	/* most of the time this will be disabled completly. Tis will also fix the
592 594
 	 * problem with the corner cases if rand() returned zero or RAND_MAX */
593 595
 	if ((*probability) == 0) return -1;
594 596
 	if ((*probability) == 100) return 1;
595 597
 
596
-	double tmp = ((double) rand() / RAND_MAX);
598
+	tmp = ((double) rand() / RAND_MAX);
597 599
 	LM_DBG("generated random %f\n", tmp);
598 600
 	if (tmp < ((double) (*probability) / 100)) {
599 601
 		LM_DBG("return true\n");
... ...
@@ -40,7 +40,7 @@
40 40
 #include "../../parser/parse_from.h"
41 41
 #include "../../usr_avp.h"
42 42
 
43
-#define TABLE_VERSION 4
43
+#define TABLE_VERSION 5
44 44
 
45 45
 struct trusted_list ***hash_table;     /* Pointer to current hash table pointer */
46 46
 struct trusted_list **hash_table_1;   /* Pointer to hash table 1 */
... ...
@@ -84,9 +84,10 @@ struct module_exports exports= {
84 84
  */
85 85
 static int mod_init(void)
86 86
 {
87
-	LM_DBG("...\n");
88 87
 	bind_pua_t bind_pua;
89 88
 	
89
+	LM_DBG("...\n");
90
+	
90 91
 	if(register_mi_mod(exports.name, mi_cmds)!=0)
91 92
 	{
92 93
 		LM_ERR("failed to register MI commands\n");
... ...
@@ -50,8 +50,6 @@
50 50
 int extract_aor(str* _uri, str* _a)
51 51
 {
52 52
 	static char aor_buf[MAX_AOR_LEN];
53
-	memset(aor_buf, 0, MAX_AOR_LEN);
54
-
55 53
 	str tmp;
56 54
 	struct sip_uri puri;
57 55
 	int user_len;
... ...
@@ -59,6 +57,7 @@ int extract_aor(str* _uri, str* _a)
59 57
 	struct usr_avp *avp;
60 58
 	str *uri;
61 59
 
60
+	memset(aor_buf, 0, MAX_AOR_LEN);
62 61
 	if (aor_avp_name.n!=0) {
63 62
 		avp = search_first_avp( aor_avp_type, aor_avp_name, &avp_val, 0);
64 63
 		if (avp && is_avp_str_val(avp)) {
... ...
@@ -210,6 +210,7 @@ decode_contact_header (struct sip_msg *msg,char *unused1,char *unused2)
210 210
 	
211 211
 	
212 212
 #ifdef DEBUG
213
+	str* ruri;
213 214
 	fprintf (stdout,"---START--------DECODE CONTACT HEADER-----------------\n");
214 215
 #endif
215 216
 
... ...
@@ -227,9 +228,9 @@ decode_contact_header (struct sip_msg *msg,char *unused1,char *unused2)
227 228
 
228 229
 #ifdef DEBUG
229 230
 	fprintf (stdout,"Using separator %c\n",separator);
230
-	str* ruri;
231 231
 	ruri = GET_RURI(msg);
232
-	fprintf (stdout,"[len = %d]New uri is->%*.s\n",ruri->len,ruri->len,ruri->s);
232
+	fprintf (stdout,"[len = %d]New uri is->%.*s\n",
233
+			ruri->len,ruri->len,ruri->s);
233 234
 	ruri = &msg->first_line.u.request.uri;
234 235
 	fprintf (stdout, "INITIAL.s=[%.*s]\n", ruri->len, ruri->s);
235 236
 #endif
... ...
@@ -192,10 +192,10 @@ static void remove_timeout(unsigned int index)
192 192
 static void insert(str callid)
193 193
 {
194 194
 	unsigned int index = hash(callid.s, callid.len) & HASHTABLEMASK;
195
-
195
+	struct ring_record_t* rr;
196
+	
196 197
 	remove_timeout(index);
197
-
198
-	struct ring_record_t* rr = shm_malloc(sizeof(struct ring_record_t));
198
+	rr = shm_malloc(sizeof(struct ring_record_t));
199 199
 	assert(rr);
200 200
 
201 201
 	rr->next = NULL;
... ...
@@ -224,10 +224,11 @@ static void insert(str callid)
224 224
 static int contains(str callid)
225 225
 {
226 226
 	unsigned int index = hash(callid.s, callid.len) & HASHTABLEMASK;
227
+	struct ring_record_t* rr;
227 228
 
228 229
 	remove_timeout(index);
229 230
 
230
-	struct ring_record_t* rr = (*hashtable)[index].head;
231
+	rr = (*hashtable)[index].head;
231 232
 	while (rr) {
232 233
 		if (strncmp(rr->callid, callid.s, callid.len) == 0) return 1;
233 234
 		rr = rr->next;
... ...
@@ -245,25 +246,38 @@ static int conv183(struct sip_msg *msg)
245 246
 	/* content-length and content-type headers are removed */
246 247
 	char *del1_start = strstr(msg->buf, "Content-Length:");
247 248
 	char *del2_start = strstr(msg->buf, "Content-Type:");
249
+	char *del1_end;
250
+	char *del2_end;
251
+	char *eoh;
252
+	char *chunk1_start;
253
+	int chunk1_len;
254
+	char *chunk1_dst;
255
+	char *chunk2_start;
256
+	int chunk2_len;
257
+	char *chunk2_dst;
258
+	char *chunk3_start;
259
+	int chunk3_len;
260
+	char *chunk3_dst;
261
+	
248 262
 	if (del1_start>del2_start) {
249 263
 		char *tmp = del1_start;
250 264
 		del1_start = del2_start;
251 265
 		del2_start = tmp;
252 266
 	}
253 267
 
254
-	char *del1_end = NULL;
268
+	del1_end = NULL;
255 269
 	if (del1_start) {
256 270
 		del1_end = strstr(del1_start, "\r\n");
257 271
 		if (del1_end) del1_end+=2;
258 272
 	}
259
-	char *del2_end = NULL;
273
+	del2_end = NULL;
260 274
 	if (del2_start) {
261 275
 		del2_end = strstr(del2_start, "\r\n");
262 276
 		if (del2_end) del2_end+=2;
263 277
 	}
264 278
 
265 279
 	/* 180 message does not need session description */
266
-	char *eoh = strstr(msg->buf, "\r\n\r\n");
280
+	eoh = strstr(msg->buf, "\r\n\r\n");
267 281
 	if (eoh) eoh+=2;
268 282
 
269 283
 	if ((!del1_start) || (!del2_start) || (!del1_end) || (!del2_end) || (!eoh)) {
... ...
@@ -288,17 +302,17 @@ static int conv183(struct sip_msg *msg)
288 302
 	strncpy(msg->first_line.u.reply.reason.s, "Ringing                                           ", msg->first_line.u.reply.reason.len);
289 303
 
290 304
 	/* calculate addresses of chunks to be moved */
291
-	char *chunk1_start = del1_end;
292
-	int chunk1_len     = del2_start-del1_end;
293
-	char *chunk1_dst   = del1_start;
305
+	chunk1_start = del1_end;
306
+	chunk1_len     = (int)(long)(del2_start-del1_end);
307
+	chunk1_dst   = del1_start;
294 308
 
295
-	char *chunk2_start = del2_end;
296
-	int chunk2_len     = eoh-del2_end;
297
-	char *chunk2_dst   = chunk1_dst+chunk1_len;
309
+	chunk2_start = del2_end;
310
+	chunk2_len     = (int)(long)(eoh-del2_end);
311
+	chunk2_dst   = chunk1_dst+chunk1_len;
298 312
 
299
-	char *chunk3_start = "Content-Length: 0\r\n\r\n";
300
-	int chunk3_len     = strlen(chunk3_start);
301
-	char *chunk3_dst   = chunk2_dst+chunk2_len;
313
+	chunk3_start = "Content-Length: 0\r\n\r\n";
314
+	chunk3_len     = strlen(chunk3_start);
315
+	chunk3_dst   = chunk2_dst+chunk2_len;
302 316
 
303 317
 	// move chunks
304 318
 	memmove(chunk1_dst, chunk1_start, chunk1_len);
... ...
@@ -123,7 +123,7 @@ static int fixup_stat(void** param, int param_no)
123 123
 		/* is it pv? */
124 124
 		if (s.s[0]=='$') {
125 125
 			if (fixup_pvar_null(param, 1)!=0) {
126
-				LM_ERR("invalid pv %.s as parameter\n",s.s);
126
+				LM_ERR("invalid pv %s as parameter\n",s.s);
127 127
 				return E_CFG;
128 128
 			}
129 129
 			sopv->pv = (pv_spec_t*)(*param);
... ...
@@ -46,6 +46,10 @@ int db_build_userbl_tree(const str *username, const str *domain, const str *tabl
46 46
 	db_key_t key[2] = { &userblacklist_username_col, &userblacklist_domain_col };
47 47
 
48 48
 	db_val_t val[2];
49
+	db1_res_t *res;
50
+	int i;
51
+	int n = 0;
52
+	void *nodeflags;
49 53
 	VAL_TYPE(val) = VAL_TYPE(val + 1) = DB1_STR;
50 54
 	VAL_NULL(val) = VAL_NULL(val + 1) = 0;
51 55
 	VAL_STR(val).s = username->s;
... ...
@@ -53,10 +57,6 @@ int db_build_userbl_tree(const str *username, const str *domain, const str *tabl
53 57
 	VAL_STR(val + 1).s = domain->s;
54 58
 	VAL_STR(val + 1).len = domain->len;
55 59
 
56
-	db1_res_t *res;
57
-	int i;
58
-	int n = 0;
59
-	void *nodeflags;
60 60
 	
61 61
 	if (userblacklist_dbf.use_table(userblacklist_dbh, table) < 0) {
62 62
 		LM_ERR("cannot use table '%.*s'.\n", table->len, table->s);
... ...
@@ -380,6 +380,8 @@ static int check_blacklist_fixup(void **arg, int arg_no)
380 380
 {
381 381
 	char *table = (char *)(*arg);
382 382
 	struct dtrie_node_t *node = NULL;
383
+	struct check_blacklist_fs_t *new_arg;
384
+	
383 385
 	if (arg_no != 1) {
384 386
 		LM_ERR("wrong number of parameters\n");
385 387
 		return -1;
... ...
@@ -402,7 +404,7 @@ static int check_blacklist_fixup(void **arg, int arg_no)
402 404
 		return -1;
403 405
 	}
404 406
 
405
-	struct check_blacklist_fs_t *new_arg = (struct check_blacklist_fs_t*)pkg_malloc(sizeof(struct check_blacklist_fs_t));
407
+	new_arg = pkg_malloc(sizeof(struct check_blacklist_fs_t));
406 408
 	if (!new_arg) {
407 409
 		PKG_MEM_ERROR;
408 410
 		return -1;
... ...
@@ -475,15 +477,17 @@ static int reload_sources(void)
475 477
 {
476 478
 	int result = 0;
477 479
 	str tmp;
480
+	struct source_t *src;
481
+	int n;
478 482
 
479 483
 	/* critical section start: avoids dirty reads when updating d-tree */
480 484
 	lock_get(lock);
481 485
 
482
-	struct source_t *src = sources->head;
486
+	src = sources->head;
483 487
 	while (src) {
484 488
 		tmp.s = src->table;
485 489
 		tmp.len = strlen(src->table);
486
-		int n = db_reload_source(&tmp, src->dtrie_root);
490
+		n = db_reload_source(&tmp, src->dtrie_root);
487 491
 		if (n < 0) {
488 492
 			LM_ERR("cannot reload source from '%.*s'\n", tmp.len, tmp.s);
489 493
 			result = -1;
... ...
@@ -1195,7 +1195,7 @@ void fparam_free_contents(fparam_t* fp)
1195 1195
 		case FPARAM_INT:
1196 1196
 		case FPARAM_STR:
1197 1197
 			/* nothing to do */
1198
-			return;
1198
+			break;
1199 1199
 		case FPARAM_REGEX:
1200 1200
 			if (fp->v.regex){
1201 1201
 				regfree(fp->v.regex);
... ...
@@ -1231,6 +1231,10 @@ void fparam_free_contents(fparam_t* fp)
1231 1231
 			}
1232 1232
 			break;
1233 1233
 	}
1234
+	if (fp->orig){
1235
+		pkg_free(fp->orig);
1236
+		fp->orig=0;
1237
+	}
1234 1238
 }
1235 1239
 
1236 1240