pdr: pldm_entity_association_tree_destroy(): Exit early on bad argument
There's no need to rely on the violence of assert() in this instance.
Just bail out if tree is NULL.
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
Change-Id: If3d1d92015f37d56ab389bed7f20892db9b63e13
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 93415da..fd00073 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -55,6 +55,7 @@
11. pdr: pldm_entity_association_tree_init(): Return NULL on failed alloc
12. pdr: pldm_entity_association_tree_visit(): Document preconditions
13. pdr: pldm_entity_association_tree_visit(): Exit early on failure
+14. pdr: pldm_entity_association_tree_destroy(): Exit early on bad argument
### Deprecated
diff --git a/src/pdr.c b/src/pdr.c
index 285aae6..3c9db5d 100644
--- a/src/pdr.c
+++ b/src/pdr.c
@@ -699,7 +699,9 @@
LIBPLDM_ABI_STABLE
void pldm_entity_association_tree_destroy(pldm_entity_association_tree *tree)
{
- assert(tree != NULL);
+ if (!tree) {
+ return;
+ }
entity_association_tree_destroy(tree->root);
free(tree);