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 <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/452130
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
This commit is contained in:
Ben Walker 2019-04-25 11:49:43 -07:00 committed by Jim Harris
parent df04be2e53
commit 795134891e

View File

@ -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;