Browse Source

exec: free local variable if there is no more memory in next attempt

Daniel-Constantin Mierla 11 years ago
parent
commit
314ea152c5
1 changed files with 1 additions and 0 deletions
  1. 1 0
      modules/exec/exec_hf.c

+ 1 - 0
modules/exec/exec_hf.c

@@ -363,6 +363,7 @@ environment_t *replace_env(struct hf_wrapper *list)
 	new_env=pkg_malloc((var_cnt+1)*sizeof(char *));
 	new_env=pkg_malloc((var_cnt+1)*sizeof(char *));
 	if (!new_env) {
 	if (!new_env) {
 		LM_ERR("no pkg mem\n");
 		LM_ERR("no pkg mem\n");
+		pkg_free(backup_env);
 		return 0;
 		return 0;
 	}
 	}
 	/* put all var pointers into new environment */
 	/* put all var pointers into new environment */