X-Git-Url: https://git.efficios.com/?p=babeltrace.git;a=blobdiff_plain;f=src%2Fplugins%2Fctf%2Fcommon%2Fmetadata%2Fparser.y;h=a75cff056afc4233a5473bffbb23d596db537f9b;hp=bada61d74bfdae66348517fdb85b6eee740187a7;hb=49a43e69c6ca442956f894029d0d8e2acae8b041;hpb=d6701381e38348beced306a0ad9947fb3fb8ad82 diff --git a/src/plugins/ctf/common/metadata/parser.y b/src/plugins/ctf/common/metadata/parser.y index bada61d7..a75cff05 100644 --- a/src/plugins/ctf/common/metadata/parser.y +++ b/src/plugins/ctf/common/metadata/parser.y @@ -1001,7 +1001,24 @@ void ctf_scanner_free(struct ctf_scanner *scanner) if (!scanner) return; - finalize_scope(&scanner->root_scope); + + struct ctf_scanner_scope *scope = scanner->cs; + + do { + struct ctf_scanner_scope *parent = scope->parent; + finalize_scope(scope); + + /* + * The root scope is allocated within the ctf_scanner structure, + * do doesn't need freeing. All others are allocated on their + * own. + */ + if (scope != &scanner->root_scope) + free(scope); + + scope = parent; + } while (scope); + objstack_destroy(scanner->objstack); ret = yylex_destroy(scanner->scanner); if (ret)