浏览代码

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

Henning Westerholt 15 年之前
父节点
当前提交
355636358c
共有 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

@@ -107,7 +107,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

@@ -2448,7 +2448,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:
@@ -2522,7 +2522,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;
@@ -2575,7 +2575,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;