From 4a57a1eb29b3af344dbc833c067205cf36a9ecf1 Mon Sep 17 00:00:00 2001
From: zhangxiaoyu <zhangxiaoyu58@huawei.com>
Date: Tue, 30 May 2023 18:59:14 +0800
Subject: [PATCH 77/79] fix layer imcomplete cause isulad core

Signed-off-by: zhangxiaoyu <zhangxiaoyu58@huawei.com>
---
 src/daemon/modules/image/oci/storage/layer_store/layer_store.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/daemon/modules/image/oci/storage/layer_store/layer_store.c b/src/daemon/modules/image/oci/storage/layer_store/layer_store.c
index 6024d734..800a1cd7 100644
--- a/src/daemon/modules/image/oci/storage/layer_store/layer_store.c
+++ b/src/daemon/modules/image/oci/storage/layer_store/layer_store.c
@@ -1937,12 +1937,13 @@ static int load_layers_from_json_files()
 
         // check complete
         if (tl->slayer->incompelte) {
+            // item and tl will free after this function
             if (do_delete_layer(tl->slayer->id) != 0) {
                 ERROR("delete layer: %s failed", tl->slayer->id);
                 ret = -1;
                 goto unlock_out;
             }
-            should_save = true;
+            continue;
         }
 
         if (should_save && save_layer(tl) != 0) {
-- 
2.25.1

