Blob Blame History Raw
From: Vlad Paiu <vladpaiu@opensips.org>
Date: Mon, 25 Jan 2016 13:32:57 +0200
Subject: [PATCH] Fix double free in case of errors when running MI command


diff --git a/modules/mi_http/http_fnc.c b/modules/mi_http/http_fnc.c
index 56b84ff..384695c 100644
--- a/modules/mi_http/http_fnc.c
+++ b/modules/mi_http/http_fnc.c
@@ -621,7 +621,6 @@ struct mi_root* mi_http_run_mi_cmd(int mod, int cmd, const str* arg,
 				(mi_flush_f *)mi_http_flush_tree, &html_page_data);
 	if (mi_rpl == NULL) {
 		LM_ERR("failed to process the command\n");
-		if (mi_cmd) free_mi_tree(mi_cmd);
 		goto error;
 	} else {
 		*page = html_page_data.page;
diff --git a/modules/mi_json/http_fnc.c b/modules/mi_json/http_fnc.c
index edf5b95..7cabb3e 100644
--- a/modules/mi_json/http_fnc.c
+++ b/modules/mi_json/http_fnc.c
@@ -325,7 +325,6 @@ struct mi_root* mi_json_run_mi_cmd(const str* miCmd, const str* params,
         NULL, &html_page_data);
   if (mi_rpl == NULL) {
     LM_ERR("failed to process the command\n");
-    if (mi_cmd) free_mi_tree(mi_cmd);
     goto error;
   } else {
     *page = html_page_data.page;
diff --git a/modules/mi_xmlrpc_ng/http_fnc.c b/modules/mi_xmlrpc_ng/http_fnc.c
index ded5f12..caa50a4 100644
--- a/modules/mi_xmlrpc_ng/http_fnc.c
+++ b/modules/mi_xmlrpc_ng/http_fnc.c
@@ -554,7 +554,6 @@ struct mi_root* mi_xmlrpc_http_run_mi_cmd(const str* arg,
 				(mi_flush_f *)mi_xmlrpc_http_flush_tree, &html_page_data);
 	if (mi_rpl == NULL) {
 		LM_ERR("failed to process the command\n");
-		if (mi_cmd) free_mi_tree(mi_cmd);
 		goto xml_error;
 	} else {
 		*page = html_page_data.page;