diff --git a/CppCrash/entry/src/main/cpp/CppCrashAdvise2.cpp b/CppCrash/entry/src/main/cpp/CppCrashAdvise2.cpp index be88d64332a59fc530227ebcb034bdc190dc5d6e..f3bc9ac2b79b29196090327bd1ad828c7a1168d9 100644 --- a/CppCrash/entry/src/main/cpp/CppCrashAdvise2.cpp +++ b/CppCrash/entry/src/main/cpp/CppCrashAdvise2.cpp @@ -67,7 +67,7 @@ void Thread1FuncEx() void Thread2FuncEx() { std::lock_guard lock(mutexEx_); - g_list.clear(); // 此处清空list,可能会造成线程1使用g_list时发生崩溃 + g_list.clear(); } // [End cppcrash_advise_2_positive] @@ -105,8 +105,6 @@ void Checker::Detection(std::string& url) bool Checker::DoCheck(const std::string& url) { - int len1 = url.find("/generate_204"); - int len = len1 - strlen("http://"); // ... return true; } diff --git a/MemoryDetection/entry/src/main/cpp/resource_leak.cpp b/MemoryDetection/entry/src/main/cpp/resource_leak.cpp index 2e2a01ab3e835b0afb656313bd87bb5547e23104..a44d7e62cd59083fdd41d7d893b8c71fff8e15d9 100644 --- a/MemoryDetection/entry/src/main/cpp/resource_leak.cpp +++ b/MemoryDetection/entry/src/main/cpp/resource_leak.cpp @@ -213,5 +213,6 @@ void DemoCase(int length) } } // ... + delete[] bitmapBuffer; } // [End resource_leak_case_1] \ No newline at end of file diff --git a/MemoryDetection/entry/src/main/ets/pages/addressproblems.cpp b/MemoryDetection/entry/src/main/ets/pages/addressproblems.cpp index 80960fedd68d03a29bcb78332ed8a41e7aa5e8c7..37144cc2a60809d0e41f8da9feb4db60a01cd57c 100644 --- a/MemoryDetection/entry/src/main/ets/pages/addressproblems.cpp +++ b/MemoryDetection/entry/src/main/ets/pages/addressproblems.cpp @@ -70,7 +70,7 @@ int heapBufferOverflow() */ // [Start address_overflow_code] -int main(int argc, char** argv) { +int main(int argc, char** argv) { int stack_array[99]; stack_array[1] = 0; @@ -139,7 +139,7 @@ public: std::cout << "Doing work\n"; } - ~Tash() { + ~Task() { std::cout << "Task destructed\n"; } };