xgupta created this revision. xgupta added reviewers: jingham, JDevlieghere. Herald added a project: All. xgupta requested review of this revision. Herald added a project: LLDB. Herald added a subscriber: lldb-commits.
Incorrect use of shared_ptr. found by PVS-Studio https://pvs-studio.com/en/blog/posts/cpp/1003/, N8 & N9. Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D142309 Files: lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp Index: lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp =================================================================== --- lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp +++ lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp @@ -2368,10 +2368,7 @@ // Allocate a buffer to copy data into const uint32_t size = *alloc->size.get(); - std::shared_ptr<uint8_t> buffer(new uint8_t[size]); - if (!buffer) { - LLDB_LOGF(log, "%s - couldn't allocate a %" PRIu32 " byte buffer", - __FUNCTION__, size); + std::shared_ptr<uint8_t []> buffer(new uint8_t[size]); return nullptr; }
Index: lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp =================================================================== --- lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp +++ lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp @@ -2368,10 +2368,7 @@ // Allocate a buffer to copy data into const uint32_t size = *alloc->size.get(); - std::shared_ptr<uint8_t> buffer(new uint8_t[size]); - if (!buffer) { - LLDB_LOGF(log, "%s - couldn't allocate a %" PRIu32 " byte buffer", - __FUNCTION__, size); + std::shared_ptr<uint8_t []> buffer(new uint8_t[size]); return nullptr; }
_______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits