Browse code

fix memset call, set the variable to zero, not to the size with length 0..

Henning Westerholt authored on 20/05/2010 13:46:58
Showing 3 changed files
... ...
@@ -107,7 +107,7 @@ cfg_script_var_t *new_cfg_script_var(char *gname, char *vname, unsigned int type
107 107
 
108 108
 	var = (cfg_script_var_t *)pkg_malloc(sizeof(cfg_script_var_t));
109 109
 	if (!var) goto error;
110
-	memset(var, sizeof(cfg_script_var_t), 0);
110
+	memset(var, 0, sizeof(cfg_script_var_t));
111 111
 	var->type = type;
112 112
 
113 113
 	/* 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"; 
... ...
@@ -2448,7 +2448,7 @@ struct rval_expr* mk_rval_expr_v(enum rval_type rv_type, void* val,
2448 2448
 	rve=pkg_malloc(sizeof(*rve));
2449 2449
 	if (rve==0) 
2450 2450
 		return 0;
2451
-	memset(rve, sizeof(*rve), 0);
2451
+	memset(rve, 0, sizeof(*rve));
2452 2452
 	flags=0;
2453 2453
 	switch(rv_type){
2454 2454
 		case RV_INT:
... ...
@@ -2522,7 +2522,7 @@ struct rval_expr* mk_rval_expr1(enum rval_expr_op op, struct rval_expr* rve1,
2522 2522
 	ret=pkg_malloc(sizeof(*ret));
2523 2523
 	if (ret==0) 
2524 2524
 		return 0;
2525
-	memset(ret, sizeof(*ret), 0);
2525
+	memset(ret, 0, sizeof(*ret));
2526 2526
 	ret->op=op;
2527 2527
 	ret->left.rve=rve1;
2528 2528
 	if (pos) ret->fpos=*pos;
... ...
@@ -2575,7 +2575,7 @@ struct rval_expr* mk_rval_expr2(enum rval_expr_op op, struct rval_expr* rve1,
2575 2575
 	ret=pkg_malloc(sizeof(*ret));
2576 2576
 	if (ret==0) 
2577 2577
 		return 0;
2578
-	memset(ret, sizeof(*ret), 0);
2578
+	memset(ret, 0, sizeof(*ret));
2579 2579
 	ret->op=op;
2580 2580
 	ret->left.rve=rve1;
2581 2581
 	ret->right.rve=rve2;