oatpp / oatpp-websocket

oatpp-websocket submodule.
https://oatpp.io/
Apache License 2.0
78 stars 32 forks source link

Fix mismatched delete for unique_ptr #19

Closed bamkrs closed 4 years ago

bamkrs commented 4 years ago

I casually run valgrind against a oatpp-websocket application and found this small - I guess - typo.

When using

std::unique_ptr<v_char8> decoded(new v_char8[size]);

A new array is created, but when freeing, only delete is used by the default deleter.

This can be fixed by using

std::unique_ptr<v_char8[]> decoded(new v_char8[size]);

Now, delete[] is called by the std-libs default deleter.

This should be checked in all other oatpp-modules, too, since its an easy copy&paste error.

lganzzzo commented 4 years ago

I just checked the main oatpp module and found the same issue in several places... I'll prepare the PR...