diff options
author | Neil <nyamatongwe@gmail.com> | 2025-02-06 09:02:39 +1100 |
---|---|---|
committer | Neil <nyamatongwe@gmail.com> | 2025-02-06 09:02:39 +1100 |
commit | 81efed752df3a07ce187f13667a05fe141075a29 (patch) | |
tree | 9f895bbb3edff744ffc9cbc65d2619d375f46b5e /src | |
parent | 75ac401067792ada13497cc886961a2f6678cbe0 (diff) | |
download | scintilla-mirror-81efed752df3a07ce187f13667a05fe141075a29.tar.gz |
Feature [feature-requests:#1540]. Avoid memory leaks caused by addition of
uninitialized_value_construct_n by using loop in InsertEmpty.
Diffstat (limited to 'src')
-rw-r--r-- | src/SplitVector.h | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/SplitVector.h b/src/SplitVector.h index 081c7cbfb..d46156e27 100644 --- a/src/SplitVector.h +++ b/src/SplitVector.h @@ -211,7 +211,10 @@ public: RoomFor(insertLength); GapTo(position); T *ptr = body.data() + part1Length; - std::uninitialized_value_construct_n(ptr, insertLength); + for (ptrdiff_t elem = 0; elem < insertLength; elem++, ptr++) { + T emptyOne = {}; + *ptr = std::move(emptyOne); + } lengthBody += insertLength; part1Length += insertLength; gapLength -= insertLength; |