From 31f2aa5729f9d6e9c1d8c06e3b979e89ff4e8e9e Mon Sep 17 00:00:00 2001 From: Evgeny Kolesnikov Date: Tue, 19 May 2020 07:26:25 +0200 Subject: [PATCH 1/3] Update yaml-filter to the latest version (fixes minor warnings) yaml-path.c:342:61: warning: comparison of integer expressions of different signedness: 'int' and 'size_t' {aka 'long unsigned int'} [-Wsign-compare] yaml-path.c:251:27: warning: unused variable 'sec' [-Wunused-variable] --- CMakeLists.txt | 4 ++-- yaml-filter | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 65d674140..8752d66c8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -545,7 +545,7 @@ include_directories( "src/XCCDF/public/" "src/XCCDF_POLICY/" "src/XCCDF_POLICY/public/" - "yaml-filter" + "yaml-filter/src/" ${CMAKE_BINARY_DIR} # config.h is generated to build directory ${LIBXML2_INCLUDE_DIR} ${PCRE_INCLUDE_DIRS} @@ -570,7 +570,7 @@ function(set_oscap_generic_properties TARGET_OBJECT) endfunction() if(OPENSCAP_PROBE_INDEPENDENT_YAMLFILECONTENT) - add_library(yamlfilter_object OBJECT yaml-filter/yaml-path.c yaml-filter/yaml-path.h) + add_library(yamlfilter_object OBJECT yaml-filter/src/yaml-path.c yaml-filter/src/yaml-path.h) set_oscap_generic_properties(yamlfilter_object) endif() From 69111f40e24a44241609f485034420bac666e756 Mon Sep 17 00:00:00 2001 From: Evgeny Kolesnikov Date: Tue, 19 May 2020 07:28:53 +0200 Subject: [PATCH 2/3] probes/yamlfilecontent: Properly destroy yaml_path before bailing out yamlfilecontent_probe.c:163: leaked_storage: Variable "yaml_path" going out of scope leaks the storage it points to. --- src/OVAL/probes/independent/yamlfilecontent_probe.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/OVAL/probes/independent/yamlfilecontent_probe.c b/src/OVAL/probes/independent/yamlfilecontent_probe.c index 8fc4b32b2..b8a379313 100644 --- a/src/OVAL/probes/independent/yamlfilecontent_probe.c +++ b/src/OVAL/probes/independent/yamlfilecontent_probe.c @@ -159,6 +159,7 @@ static int yaml_path_query(const char *filepath, const char *yaml_path_cstr, str probe_cobj_add_msg(probe_ctx_getresult(ctx), msg); SEXP_free(msg); probe_cobj_set_flag(probe_ctx_getresult(ctx), SYSCHAR_FLAG_ERROR); + yaml_path_destroy(yaml_path); fclose(yaml_file); return -1; };