From 30e2d170f14c534a0cddadc9513331f2afd63656 Mon Sep 17 00:00:00 2001
From: Ali Mohammed <ali.mohammed@hpe.com>
Date: Mon, 30 Jan 2023 14:08:22 +0100
Subject: [PATCH] cleanup unused reg entry

---
 maestro/pool_manager_registry.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/maestro/pool_manager_registry.c b/maestro/pool_manager_registry.c
index 96eaecd5..18e2cedd 100644
--- a/maestro/pool_manager_registry.c
+++ b/maestro/pool_manager_registry.c
@@ -259,11 +259,17 @@ mstro_pc_app_register_pending(mstro_app_id id)
         if((elt!=NULL) && (elt->pending)) {
           //FIXME should be a warning as we can handle this 
           ERR("There is alreading a pending entry for app %"PRIappid", should not overwrite \n", id);
+          /*cleanup*/
+          status = mstro_pm_app_reg__entry_dispose(e);
+          assert(status ==MSTRO_OK);
           return MSTRO_FAIL;
         }
         else if((elt!=NULL) && (!elt->pending))
         {
           ERR("App %"PRIappid" already exists in regsitry, should not overwrite \n", id);
+          /*cleanup*/
+          status = mstro_pm_app_reg__entry_dispose(e);
+          assert(status ==MSTRO_OK);
           return MSTRO_FAIL;
         }
         else { // elt == NULL
-- 
GitLab