Release memory allocated for chunk before return error.

Signed-off-by: Huang Jianan <[email protected]>
---
 lib/blobchunk.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lib/blobchunk.c b/lib/blobchunk.c
index 5cbb831..b605b0b 100644
--- a/lib/blobchunk.c
+++ b/lib/blobchunk.c
@@ -78,6 +78,7 @@ static struct erofs_blobchunk *erofs_blob_getchunk(int fd,
 
                hashmap_entry_init(&key, hash);
                hashmap_remove(&blob_hashmap, &key, sha256);
+               free(chunk);
                chunk = ERR_PTR(-ENOSPC);
                goto out;
        }
-- 
2.25.1

Reply via email to