From 7fe9a7be312b6889840f8e05db16da848aca0e10 Mon Sep 17 00:00:00 2001 From: Nicolas Iooss Date: Sun, 19 Feb 2017 11:30:54 +0100 Subject: [PATCH] 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 --- libsepol/cil/src/cil_resolve_ast.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libsepol/cil/src/cil_resolve_ast.c b/libsepol/cil/src/cil_resolve_ast.c index 6628dc4d..5e5298d9 100644 --- a/libsepol/cil/src/cil_resolve_ast.c +++ b/libsepol/cil/src/cil_resolve_ast.c @@ -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; }