summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Drake <michael.drake@codethink.co.uk>2021-06-28 17:26:18 +0100
committerMichael Drake <michael.drake@codethink.co.uk>2021-06-28 17:26:18 +0100
commit7595126d25277f09f9a0fb3769407428d3862402 (patch)
tree6172b4596c4f37c967b8f7fa8dc1e8b99d7a9e3b
parentc81f7ac01a3b7950749290855041a74517d4513e (diff)
downloadlibdom-7595126d25277f09f9a0fb3769407428d3862402.tar.gz
libdom-7595126d25277f09f9a0fb3769407428d3862402.tar.bz2
Example: Clean up LWC string table.
All leaks squashed.
-rw-r--r--examples/dom-structure-dump.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/examples/dom-structure-dump.c b/examples/dom-structure-dump.c
index b36bac2..c719903 100644
--- a/examples/dom-structure-dump.c
+++ b/examples/dom-structure-dump.c
@@ -312,6 +312,15 @@ bool dump_dom_structure(dom_node *node, int depth)
return true;
}
+/* LWC leak callback */
+void sd__fini_lwc_callback(lwc_string *str, void *pw)
+{
+ (void)(pw);
+
+ fprintf(stderr, "Leaked string: %.*s\n",
+ (int)lwc_string_length(str),
+ lwc_string_data(str));
+}
/**
* Main entry point from OS.
@@ -355,6 +364,7 @@ int main(int argc, char **argv)
dom_node_unref(doc);
dom_namespace_finalise();
+ lwc_iterate_strings(sd__fini_lwc_callback, NULL);
return EXIT_SUCCESS;
}