提交 f8138092 编写于 作者: A Anders Kaseorg 提交者: David S. Miller

tipc: Fix log buffer memory leak if initialization fails

Moves log buffer cleanup into tipc_core_stop() so that memory allocated
for the log buffer is freed if tipc_core_start() is unsuccessful.
Signed-off-by: NAnders Kaseorg <andersk@ksplice.com>
Signed-off-by: NAllan Stephens <allan.stephens@windriver.com>
Signed-off-by: NPaul Gortmaker <paul.gortmaker@windriver.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 24763d80
...@@ -169,6 +169,7 @@ void tipc_core_stop(void) ...@@ -169,6 +169,7 @@ void tipc_core_stop(void)
tipc_nametbl_stop(); tipc_nametbl_stop();
tipc_ref_table_stop(); tipc_ref_table_stop();
tipc_socket_stop(); tipc_socket_stop();
tipc_log_resize(0);
} }
/** /**
...@@ -203,7 +204,9 @@ static int __init tipc_init(void) ...@@ -203,7 +204,9 @@ static int __init tipc_init(void)
{ {
int res; int res;
tipc_log_resize(CONFIG_TIPC_LOG); if (tipc_log_resize(CONFIG_TIPC_LOG) != 0)
warn("Unable to create log buffer\n");
info("Activated (version " TIPC_MOD_VER info("Activated (version " TIPC_MOD_VER
" compiled " __DATE__ " " __TIME__ ")\n"); " compiled " __DATE__ " " __TIME__ ")\n");
...@@ -230,7 +233,6 @@ static void __exit tipc_exit(void) ...@@ -230,7 +233,6 @@ static void __exit tipc_exit(void)
tipc_core_stop_net(); tipc_core_stop_net();
tipc_core_stop(); tipc_core_stop();
info("Deactivated\n"); info("Deactivated\n");
tipc_log_resize(0);
} }
module_init(tipc_init); module_init(tipc_init);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册