From 97584bdcd1ac49f9f7299d7dbff40f2007d99f0b Mon Sep 17 00:00:00 2001 From: Philip Minakov Date: Wed, 11 Mar 2026 13:16:51 +0400 Subject: [PATCH] Add pd_free_node function --- src/pd.c | 6 ++++++ src/pd.h | 1 + 2 files changed, 7 insertions(+) diff --git a/src/pd.c b/src/pd.c index 7317887..2845439 100644 --- a/src/pd.c +++ b/src/pd.c @@ -260,6 +260,12 @@ int pd_write_file(const char *file_name, const pd_node_t **nodes) { return 0; } +void pd_free_node(pd_node_t *node) { + if (node) { + free(node); + } +} + void pd_free_nodes(pd_node_t **nodes) { if (nodes) { for (int i = 0; nodes[i] != NULL; i++) { diff --git a/src/pd.h b/src/pd.h index 0c2582a..b01156c 100644 --- a/src/pd.h +++ b/src/pd.h @@ -27,6 +27,7 @@ pd_node_t *pd_alloc_integer_node(const char *group, const char *key, int value); pd_node_t *pd_alloc_string_node(const char *group, const char *key, const char *value); int pd_read_file(const char *file_name, pd_node_t ***nodes); int pd_write_file(const char *file_name, const pd_node_t **nodes); +void pd_free_node(pd_node_t *node); void pd_free_nodes(pd_node_t **nodes); int pd_get_max_group_size();