Преглед на файлове

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

Henning Westerholt преди 15 години
родител
ревизия
fc9770f9a5
променени са 3 файла, в които са добавени 5 реда и са изтрити 5 реда
  1. 1 1
      cfg/cfg_script.c
  2. 1 1
      modules_k/xcap_client/xcap_functions.c
  3. 3 3
      rvalue.c

+ 1 - 1
cfg/cfg_script.c

@@ -112,7 +112,7 @@ cfg_script_var_t *new_cfg_script_var(char *gname, char *vname, unsigned int type
 
 	var = (cfg_script_var_t *)pkg_malloc(sizeof(cfg_script_var_t));
 	if (!var) goto error;
-	memset(var, sizeof(cfg_script_var_t), 0);
+	memset(var, 0, sizeof(cfg_script_var_t));
 	var->type = type;
 
 	/* add the variable to the group */

+ 1 - 1
modules_k/xcap_client/xcap_functions.c

@@ -531,7 +531,7 @@ char* send_http_get(char* path, unsigned int xcap_port, char* match_etag,
 	{
 		char* hdr_name= NULL;
 		
-		memset(buf, 128* sizeof(char), 0);
+		memset(buf, 0, 128* sizeof(char));
 		match_header= buf;
 		
 		hdr_name= (match_type==IF_MATCH)?"If-Match":"If-None-Match"; 

+ 3 - 3
rvalue.c

@@ -2441,7 +2441,7 @@ struct rval_expr* mk_rval_expr_v(enum rval_type rv_type, void* val,
 	rve=pkg_malloc(sizeof(*rve));
 	if (rve==0) 
 		return 0;
-	memset(rve, sizeof(*rve), 0);
+	memset(rve, 0, sizeof(*rve));
 	flags=0;
 	switch(rv_type){
 		case RV_INT:
@@ -2515,7 +2515,7 @@ struct rval_expr* mk_rval_expr1(enum rval_expr_op op, struct rval_expr* rve1,
 	ret=pkg_malloc(sizeof(*ret));
 	if (ret==0) 
 		return 0;
-	memset(ret, sizeof(*ret), 0);
+	memset(ret, 0, sizeof(*ret));
 	ret->op=op;
 	ret->left.rve=rve1;
 	if (pos) ret->fpos=*pos;
@@ -2568,7 +2568,7 @@ struct rval_expr* mk_rval_expr2(enum rval_expr_op op, struct rval_expr* rve1,
 	ret=pkg_malloc(sizeof(*ret));
 	if (ret==0) 
 		return 0;
-	memset(ret, sizeof(*ret), 0);
+	memset(ret, 0, sizeof(*ret));
 	ret->op=op;
 	ret->left.rve=rve1;
 	ret->right.rve=rve2;