From 0f9f7986913cee585214966b3d6ee62bcd54d9b5 Mon Sep 17 00:00:00 2001 From: Max Wash Date: Thu, 27 Feb 2025 15:51:38 +0000 Subject: [PATCH] cluster-cache: fix get() not assigning data buffer to another cache entry after evicting it --- src/cluster-cache.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/cluster-cache.c b/src/cluster-cache.c index 25cdea7..97332c5 100644 --- a/src/cluster-cache.c +++ b/src/cluster-cache.c @@ -162,12 +162,14 @@ enum ec3_status cluster_cache_get( return status; } + entry->e_data = buf; + size_t nr_read = 0; enum b_status status2 = b_file_read( cache->c_storage, entry->e_storage_offset, entry->e_length, - buf, + entry->e_data, &nr_read); if (!B_OK(status2)) { @@ -178,7 +180,7 @@ enum ec3_status cluster_cache_get( return EC3_ERR_IO_FAILURE; } - memcpy(out, buf, nr_read); + memcpy(out, entry->e_data, nr_read); *cluster_size = nr_read; return EC3_SUCCESS; }