From 499ac3681aca41d74e3943cd2188e7c2b5fb4703 Mon Sep 17 00:00:00 2001 From: Magnus Jacobsson Date: Sun, 17 Jul 2022 13:13:14 +0200 Subject: [PATCH] osage_cleanup: add missing cleanup of edges This fixes a memory leak detected by ASan in the test_engines test, which now runs without failures --- CHANGELOG.md | 1 + lib/osage/osageinit.c | 3 +++ tests/CMakeLists.txt | 1 - 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 40b3f344f..73632a20d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - missing Perl includes patch #2262 - smyrna: incorrect tokenization in frmobjectui.c:set_attr_object_type #2259 - [Dot] Record shape+UTF+" | "=Eats spaces. #925 +- Memory leak in osage ## [5.0.0] – 2022-07-07 diff --git a/lib/osage/osageinit.c b/lib/osage/osageinit.c index 2349a7df7..3d0028b7c 100644 --- a/lib/osage/osageinit.c +++ b/lib/osage/osageinit.c @@ -388,6 +388,9 @@ void osage_cleanup(Agraph_t *g) node_t *n; for (n = agfstnode(g); n; n = agnxtnode(g, n)) { + for (edge_t *e = agfstout(g, n); e; e = agnxtout(g, e)) { + gv_cleanup_edge(e); + } gv_cleanup_node(n); } cleanup_graphs(g); diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 242d1c322..fb3492885 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -68,7 +68,6 @@ endmacro() CREATE_TEST(AGraph_construction) CREATE_TEST(engines) -set_tests_properties(test_engines PROPERTIES WILL_FAIL true) CREATE_TEST(GVContext_construction) CREATE_TEST(GVContext_render_svg) CREATE_TEST(GVLayout_construction) -- 2.40.0