diff options
author | Sung-hun Kim <sfoon.kim@samsung.com> | 2024-07-04 10:04:59 +0900 |
---|---|---|
committer | Sung-hun Kim <sfoon.kim@samsung.com> | 2024-07-04 10:04:59 +0900 |
commit | 4b52310031e7a1849a74f298479782ed08840cc6 (patch) | |
tree | d583f8f72cf5f02f26e1c997100bb417088f1919 | |
parent | 28d2ec4f084e41bc3983b3ae59317dc20cc1719b (diff) | |
download | ttrace-4b52310031e7a1849a74f298479782ed08840cc6.tar.gz ttrace-4b52310031e7a1849a74f298479782ed08840cc6.tar.bz2 ttrace-4b52310031e7a1849a74f298479782ed08840cc6.zip |
atrace: Fix a svace issueaccepted/tizen/unified/x/asan/20240813.225725accepted/tizen/unified/x/20240705.012351accepted/tizen/unified/toolchain/20240812.131449accepted/tizen/unified/dev/20240708.001750accepted/tizen/unified/20240704.173826accepted/tizen_unified_dev
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>
-rwxr-xr-x | atrace/atrace.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/atrace/atrace.cpp b/atrace/atrace.cpp index a465be0..4d06845 100755 --- a/atrace/atrace.cpp +++ b/atrace/atrace.cpp @@ -757,8 +757,8 @@ static void dumpTrace(bool startup) } 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); |