From 721ca97d9549bec4506adab4ac771226872cbf44 Mon Sep 17 00:00:00 2001 From: Kirill Artemov Date: Sat, 5 May 2018 04:24:27 +0300 Subject: [PATCH] ImVector: Tweaked reserve() flow to avoid calling MemFree(NULL) which is unnecessary. (#1796) --- imgui.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/imgui.h b/imgui.h index f4cbbec7..163aa3bd 100644 --- a/imgui.h +++ b/imgui.h @@ -1235,8 +1235,10 @@ public: return; value_type* new_data = (value_type*)ImGui::MemAlloc((size_t)new_capacity * sizeof(value_type)); if (Data) + { memcpy(new_data, Data, (size_t)Size * sizeof(value_type)); - ImGui::MemFree(Data); + ImGui::MemFree(Data); + } Data = new_data; Capacity = new_capacity; }