From 795134891e85e6d445a25318ed4f03da9f3dc8f3 Mon Sep 17 00:00:00 2001 From: Ben Walker Date: Thu, 25 Apr 2019 11:49:43 -0700 Subject: [PATCH] blob: Don't reallocate cluster array if it didn't change size. Other threads are referring to this memory. Change-Id: I9689a1b64a1f032ad479ec85095d2575dcab3a7f Signed-off-by: Ben Walker Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/452130 Tested-by: SPDK CI Jenkins Reviewed-by: Jim Harris Reviewed-by: Changpeng Liu --- lib/blob/blobstore.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/blob/blobstore.c b/lib/blob/blobstore.c index ccab4e3fae..7f4f22667f 100644 --- a/lib/blob/blobstore.c +++ b/lib/blob/blobstore.c @@ -1128,7 +1128,7 @@ _spdk_blob_persist_clear_clusters_cpl(spdk_bs_sequence_t *seq, void *cb_arg, int free(blob->active.clusters); blob->active.clusters = NULL; blob->active.cluster_array_size = 0; - } else { + } else if (blob->active.num_clusters != blob->active.cluster_array_size) { tmp = realloc(blob->active.clusters, sizeof(uint64_t) * blob->active.num_clusters); assert(tmp != NULL); blob->active.clusters = tmp;