The new operator in C++ does not return nullptr when it is failed.
Instead, it throws a bad_alloc exception to notify the failure.
With an optional `std::nothrow` keyword, the new operator returns
nullptr instead of exception throwing when it is failed.
This patch fixes a svace issue 209972.
Change-Id: I6a6f900f06bf7911fc9aa53366d5da6375680915
Signed-off-by: Sung-hun Kim <sfoon.kim@samsung.com>
}
const size_t bufSize = 64*1024;
- std::unique_ptr<uint8_t[]> in(new uint8_t[bufSize]);
- std::unique_ptr<uint8_t[]> out(new uint8_t[bufSize]);
+ std::unique_ptr<uint8_t[]> in(new(std::nothrow) uint8_t[bufSize]);
+ std::unique_ptr<uint8_t[]> out(new(std::nothrow) uint8_t[bufSize]);
if ((in == nullptr) || (out == nullptr)) {
fprintf(stderr, "Could not allocate memory");
close(traceFD);