浏览代码

htable: init allocated memory after checking parameter

- avoid useless operation and extra check for leak
Daniel-Constantin Mierla 11 年之前
父节点
当前提交
9f042bb279
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1 1
      modules/htable/htable.c

+ 1 - 1
modules/htable/htable.c

@@ -266,12 +266,12 @@ static int fixup_ht_key(void** param, int param_no)
 	pv_spec_t *sp;
 	str s;
 
-	sp = (pv_spec_t*)pkg_malloc(sizeof(pv_spec_t));
 	if(param_no != 1)
 	{
 		LM_ERR("invalid parameter number %d\n", param_no);
 		return -1;
 	}
+	sp = (pv_spec_t*)pkg_malloc(sizeof(pv_spec_t));
 	if (sp == 0)
 	{
 		LM_ERR("no pkg memory left\n");