libsepol/cil: use __cil_ordered_lists_destroy() to free unordered_classorder_lists

In cil_resolve_ast, unordered_classorder_lists is a list of
cil_ordered_list. It needs to be destroyed with
__cil_ordered_lists_destroy() to free all associated memory.

This has been tested with the following policy:

    (class CLASS1 ())
    (class CLASS2 ())
    (classorder (unordered CLASS1))
    (classorder (CLASS2))

This memory leak has been found by running clang's Address Sanitizer on
a set of policies generated by American Fuzzy Lop.

Signed-off-by: Nicolas Iooss <nicolas.iooss@m4x.org>
This commit is contained in:
Nicolas Iooss 2017-02-19 11:30:54 +01:00 committed by James Carter
parent 9edcf28a04
commit 7fe9a7be31

View File

@ -3936,8 +3936,8 @@ exit:
__cil_ordered_lists_destroy(&extra_args.classorder_lists);
__cil_ordered_lists_destroy(&extra_args.catorder_lists);
__cil_ordered_lists_destroy(&extra_args.sensitivityorder_lists);
__cil_ordered_lists_destroy(&extra_args.unordered_classorder_lists);
cil_list_destroy(&extra_args.in_list, CIL_FALSE);
cil_list_destroy(&extra_args.unordered_classorder_lists, CIL_FALSE);
return rc;
}