From 531e4def99500fefbb509fee2fd61cb59802a362 Mon Sep 17 00:00:00 2001 From: Thomas Schoebel-Theuer Date: Sat, 5 Jan 2013 06:11:07 +0100 Subject: [PATCH] infra: fix memleak when brick is not killable --- sy_old/sy_generic.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/sy_old/sy_generic.c b/sy_old/sy_generic.c index 644c536c..56bc24f2 100644 --- a/sy_old/sy_generic.c +++ b/sy_old/sy_generic.c @@ -1131,6 +1131,11 @@ int mars_kill_brick(struct mars_brick *brick) MARS_DBG("===> killing brick %s path = '%s' name = '%s'\n", brick->type ? SAFE_STR(brick->type->type_name) : "undef", SAFE_STR(brick->brick_path), SAFE_STR(brick->brick_name)); + if (unlikely(brick->nr_outputs > 0 && brick->outputs[0] && brick->outputs[0]->nr_connected)) { + MARS_ERR("sorry, output is in use '%s'\n", SAFE_STR(brick->brick_path)); + goto done; + } + if (global) { down_write(&global->brick_mutex); list_del_init(&brick->global_brick_link); @@ -1142,11 +1147,6 @@ int mars_kill_brick(struct mars_brick *brick) brick->show_status(brick, true); } - if (unlikely(brick->nr_outputs > 0 && brick->outputs[0] && brick->outputs[0]->nr_connected)) { - MARS_ERR("sorry, output is in use '%s'\n", SAFE_STR(brick->brick_path)); - goto done; - } - // start shutdown status = set_recursive_button((void*)brick, BR_FREE_ONE, 0);