Skip to content

Commit 9db25bf

Browse files
authored
bug fix - delete vs delete[]
1 parent 41b7e2a commit 9db25bf

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

claujson_internal.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ namespace claujson {
207207
}
208208
~Vector() {
209209
if (type == 1 && ptr) {
210-
delete ptr;
210+
delete[] ptr;
211211
ptr = nullptr;
212212
sz = 0;
213213
type = 0;
@@ -249,7 +249,7 @@ namespace claujson {
249249
public:
250250
void clear() {
251251
if (type == 1 && ptr) {
252-
delete ptr;
252+
delete[] ptr;
253253
ptr = nullptr;
254254
}
255255
capacity = SIZE;
@@ -282,7 +282,7 @@ namespace claujson {
282282
++sz;
283283
if (sz == SIZE) {
284284
if (ptr) {
285-
delete ptr; ptr = nullptr;
285+
delete[] ptr; ptr = nullptr;
286286
}
287287
ptr = new (std::nothrow) T[SIZE * 2];
288288
if (!ptr) {
@@ -305,7 +305,7 @@ namespace claujson {
305305
}
306306
memcpy(temp, ptr, sz * sizeof(T));
307307
capacity = capacity * 2;
308-
delete ptr;
308+
delete[] ptr;
309309
ptr = temp;
310310
ptr[sz] = std::move(val);
311311
++sz;

0 commit comments

Comments
 (0)