Browse code

fix memset call, set the variable to zero, not to the size with length 0.. (cherry picked from commit 355636358c07b8da9b1fcd6d04cdaf337c9f730c)

Henning Westerholt authored on 20/05/2010 13:46:58
Showing 3 changed files
... ...
@@ -112,7 +112,7 @@ cfg_script_var_t *new_cfg_script_var(char *gname, char *vname, unsigned int type
112 112
 
113 113
 	var = (cfg_script_var_t *)pkg_malloc(sizeof(cfg_script_var_t));
114 114
 	if (!var) goto error;
115
-	memset(var, sizeof(cfg_script_var_t), 0);
115
+	memset(var, 0, sizeof(cfg_script_var_t));
116 116
 	var->type = type;
117 117
 
118 118
 	/* add the variable to the group */
... ...
@@ -531,7 +531,7 @@ char* send_http_get(char* path, unsigned int xcap_port, char* match_etag,
531 531
 	{
532 532
 		char* hdr_name= NULL;
533 533
 		
534
-		memset(buf, 128* sizeof(char), 0);
534
+		memset(buf, 0, 128* sizeof(char));
535 535
 		match_header= buf;
536 536
 		
537 537
 		hdr_name= (match_type==IF_MATCH)?"If-Match":"If-None-Match"; 
... ...
@@ -2441,7 +2441,7 @@ struct rval_expr* mk_rval_expr_v(enum rval_type rv_type, void* val,
2441 2441
 	rve=pkg_malloc(sizeof(*rve));
2442 2442
 	if (rve==0) 
2443 2443
 		return 0;
2444
-	memset(rve, sizeof(*rve), 0);
2444
+	memset(rve, 0, sizeof(*rve));
2445 2445
 	flags=0;
2446 2446
 	switch(rv_type){
2447 2447
 		case RV_INT:
... ...
@@ -2515,7 +2515,7 @@ struct rval_expr* mk_rval_expr1(enum rval_expr_op op, struct rval_expr* rve1,
2515 2515
 	ret=pkg_malloc(sizeof(*ret));
2516 2516
 	if (ret==0) 
2517 2517
 		return 0;
2518
-	memset(ret, sizeof(*ret), 0);
2518
+	memset(ret, 0, sizeof(*ret));
2519 2519
 	ret->op=op;
2520 2520
 	ret->left.rve=rve1;
2521 2521
 	if (pos) ret->fpos=*pos;
... ...
@@ -2568,7 +2568,7 @@ struct rval_expr* mk_rval_expr2(enum rval_expr_op op, struct rval_expr* rve1,
2568 2568
 	ret=pkg_malloc(sizeof(*ret));
2569 2569
 	if (ret==0) 
2570 2570
 		return 0;
2571
-	memset(ret, sizeof(*ret), 0);
2571
+	memset(ret, 0, sizeof(*ret));
2572 2572
 	ret->op=op;
2573 2573
 	ret->left.rve=rve1;
2574 2574
 	ret->right.rve=rve2;