From 7d881427d4553884d7f7b5cd8d595d83531fc2d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcin=20Cie=C5=9Blak?= Date: Wed, 16 May 2018 00:20:37 +0200 Subject: [PATCH] Use delete[] after new[] MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit gmake: Wejście do katalogu '/usr/home/saper/sw/misskey/build' CXX(target) Release/obj.target/crypto_key/src/crypto_key.o ../src/crypto_key.cc:25:3: warning: 'delete' applied to a pointer that was allocated with 'new[]'; did you mean 'delete[]'? [-Wmismatched-new-delete] delete sourceBuf; ^ [] ../src/crypto_key.cc:18:25: note: allocated with 'new[]' here const auto sourceBuf = new char[sourceLength]; ^ ../src/crypto_key.cc:32:2: warning: 'delete' applied to a pointer that was allocated with 'new[]'; did you mean 'delete[]'? [-Wmismatched-new-delete] delete sourceBuf; ^ [] ../src/crypto_key.cc:18:25: note: allocated with 'new[]' here const auto sourceBuf = new char[sourceLength]; ^ 2 warnings generated. --- src/crypto_key.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/crypto_key.cc b/src/crypto_key.cc index c8e4d8f7f..fe67b1453 100644 --- a/src/crypto_key.cc +++ b/src/crypto_key.cc @@ -22,14 +22,14 @@ NAN_METHOD(extractPublic) const auto source = BIO_new_mem_buf(sourceBuf, sourceLength); if (source == nullptr) { Nan::ThrowError("Memory allocation failed"); - delete sourceBuf; + delete[] sourceBuf; return; } const auto rsa = PEM_read_bio_RSAPrivateKey(source, nullptr, nullptr, nullptr); BIO_free(source); - delete sourceBuf; + delete[] sourceBuf; if (rsa == nullptr) { Nan::ThrowError("Decode failed");