From 4239f8a81aa5da52667149a4933956347492b748 Mon Sep 17 00:00:00 2001 From: Cynthia Shang Date: Tue, 8 Sep 2020 12:47:35 -0400 Subject: [PATCH] Add manifestFree(). --- src/info/manifest.c | 1 + src/info/manifest.h | 5 +++++ test/src/module/info/manifestTest.c | 5 ++++- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/info/manifest.c b/src/info/manifest.c index 686a1292a..60f1f8921 100644 --- a/src/info/manifest.c +++ b/src/info/manifest.c @@ -164,6 +164,7 @@ struct Manifest }; OBJECT_DEFINE_MOVE(MANIFEST); +OBJECT_DEFINE_FREE(MANIFEST); /*********************************************************************************************************************************** Internal functions to add types to their lists diff --git a/src/info/manifest.h b/src/info/manifest.h index e3a64ea9e..631e03c00 100644 --- a/src/info/manifest.h +++ b/src/info/manifest.h @@ -264,6 +264,11 @@ const ManifestData *manifestData(const Manifest *this); // Set backup label void manifestBackupLabelSet(Manifest *this, const String *backupLabel); +/*********************************************************************************************************************************** +Destructor +***********************************************************************************************************************************/ +void manifestFree(Manifest *this); + /*********************************************************************************************************************************** Helper functions ***********************************************************************************************************************************/ diff --git a/test/src/module/info/manifestTest.c b/test/src/module/info/manifestTest.c index d822f470e..b04206fa5 100644 --- a/test/src/module/info/manifestTest.c +++ b/test/src/module/info/manifestTest.c @@ -2010,7 +2010,7 @@ testRun(void) } // ***************************************************************************************************************************** - if (testBegin("manifestLoadFile()")) + if (testBegin("manifestLoadFile(), manifestFree()")) { Manifest *manifest = NULL; @@ -2090,5 +2090,8 @@ testRun(void) storagePutP(storageNewWriteP(storageTest, BACKUP_MANIFEST_FILE_STR), content), "write main"); TEST_ASSIGN(manifest, manifestLoadFile(storageTest, STRDEF(BACKUP_MANIFEST_FILE), cipherTypeNone, NULL), "load main"); TEST_RESULT_UINT(manifestData(manifest)->pgSystemId, 1000000000000000094, " check file loaded"); + + TEST_RESULT_VOID(manifestFree(manifest), "free manifest"); + TEST_RESULT_VOID(manifestFree(NULL), "free null manifest"); } }