From 0c8ca02727b83c5bcbf896010e675762fdc333f5 Mon Sep 17 00:00:00 2001 From: xie xingguo Date: Mon, 14 Aug 2017 14:19:09 +0800 Subject: [PATCH] crush: update crush_choose_arg_map size on resizing Signed-off-by: xie xingguo --- src/crush/CrushWrapper.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/crush/CrushWrapper.cc b/src/crush/CrushWrapper.cc index 1dbcc3d6f38..d95e8b8d6d0 100644 --- a/src/crush/CrushWrapper.cc +++ b/src/crush/CrushWrapper.cc @@ -1963,8 +1963,10 @@ int CrushWrapper::device_class_clone( unsigned new_size = -1-bno + 1; cmap.args = (crush_choose_arg*)realloc(cmap.args, new_size * sizeof(cmap.args[0])); + assert(cmap.args); memset(cmap.args + cmap.size, 0, (new_size - cmap.size) * sizeof(cmap.args[0])); + cmap.size = new_size; } auto& o = cmap.args[-1-original_id]; auto& n = cmap.args[-1-bno]; -- 2.39.5