diff --git a/src/utils/acmp.cc b/src/utils/acmp.cc index fb61f31d99..c1614b3fe5 100644 --- a/src/utils/acmp.cc +++ b/src/utils/acmp.cc @@ -226,7 +226,7 @@ static void acmp_build_binary_tree(ACMP *parser, acmp_node_t *node) { /* We have array with all children of the node and number of those children */ - for (i = 0; i < count - 1; i++) + for (i = 0; i < count - 1; i++) { for (j = i + 1; j < count; j++) { acmp_node_t *tmp; @@ -236,10 +236,11 @@ static void acmp_build_binary_tree(ACMP *parser, acmp_node_t *node) { nodes[i] = nodes[j]; nodes[j] = tmp; } - if (node->btree != NULL) { - free(node->btree); - node->btree = NULL; - } + } + if (node->btree != NULL) { + free(node->btree); + node->btree = NULL; + } node->btree = reinterpret_cast(calloc(1, sizeof(acmp_btree_node_t))); /* ENH: Check alloc succeded */