Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 34abe0cf authored by George Burgess IV's avatar George Burgess IV Committed by android-build-merger
Browse files

Merge "Fix static analyzer warnings"

am: 7176951b

Change-Id: Ie0e915a07644d0537b3e29a3b756705d45703e7f
parents d56fee76 7176951b
Loading
Loading
Loading
Loading
+9 −8
Original line number Diff line number Diff line
@@ -73,15 +73,18 @@ TEST_F(DisableMallocTest, deadlock_allocate) {
TEST_F(DisableMallocTest, deadlock_new) {
  ASSERT_DEATH(
      {
        char* ptr = new (char);
        // C++ allows `new Foo` to be replaced with a stack allocation or merged
        // with future `new Foo` expressions, provided certain conditions are
        // met [expr.new/10]. None of this applies to `operator new(size_t)`.
        void* ptr = ::operator new(1);
        ASSERT_NE(ptr, nullptr);
        delete (ptr);
        ::operator delete(ptr);
        {
          alarm(100ms);
          ScopedDisableMalloc disable_malloc;
          char* ptr = new (std::nothrow)(char);
          void* ptr = ::operator new(1);
          ASSERT_NE(ptr, nullptr);
          delete (ptr);
          ::operator delete(ptr);
        }
      },
      "");
@@ -90,14 +93,12 @@ TEST_F(DisableMallocTest, deadlock_new) {
TEST_F(DisableMallocTest, deadlock_delete) {
  ASSERT_DEATH(
      {
        char* ptr = new (char);
        void* ptr = ::operator new(1);
        ASSERT_NE(ptr, nullptr);
        {
          alarm(250ms);
          ScopedDisableMalloc disable_malloc;
          delete (ptr);
          // Force ptr usage or this code gets optimized away by the arm64 compiler.
          ASSERT_NE(ptr, nullptr);
          ::operator delete(ptr);
        }
      },
      "");