pdr: pldm_pdr_destroy(): Exit early if repo is NULL
There's no reason to invoke the violence of assert() if the repo is
NULL, just bail out.
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
Change-Id: Ib887a98d4f57932299144c5fa0f09ff53fb8984b
diff --git a/CHANGELOG.md b/CHANGELOG.md
index d249a68..601fbbc 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -30,6 +30,7 @@
4. bios_table: pldm_bios_table_iter_create(): Return NULL on failed alloc
5. bios_table: pldm_bios_table_iter_next(): Invalid entry halts iteration
6. pdr: pldm_pdr_init(): Return NULL on allocation failure
+7. pdr: pldm_pdr_destroy(): Exit early if repo is NULL
### Deprecated
diff --git a/src/pdr.c b/src/pdr.c
index 763fa72..65b7e5c 100644
--- a/src/pdr.c
+++ b/src/pdr.c
@@ -131,7 +131,9 @@
LIBPLDM_ABI_STABLE
void pldm_pdr_destroy(pldm_pdr *repo)
{
- assert(repo != NULL);
+ if (!repo) {
+ return;
+ }
pldm_pdr_record *record = repo->first;
while (record != NULL) {