Use delete[] after new[]
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.
This commit is contained in:
parent
87862ba18b
commit
7d881427d4
1 changed files with 2 additions and 2 deletions
|
@ -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");
|
||||
|
|
Loading…
Reference in a new issue