Merge "CursorWindow_test: fix leaks" am: b3a175ac30
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2240845 Change-Id: I6f96dbe4bc8494309087d9a15867bcd5f276d554 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -14,6 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
|
||||
#include "androidfw/CursorWindow.h"
|
||||
@@ -184,7 +185,7 @@ TEST(CursorWindowTest, Inflate) {
|
||||
ASSERT_EQ(w->allocRow(), OK);
|
||||
|
||||
// Scratch buffer that will fit before inflation
|
||||
void* buf = malloc(kHalfInlineSize);
|
||||
char buf[kHalfInlineSize];
|
||||
|
||||
// Store simple value
|
||||
ASSERT_EQ(w->putLong(0, 0, 0xcafe), OK);
|
||||
@@ -262,7 +263,7 @@ TEST(CursorWindowTest, ParcelSmall) {
|
||||
ASSERT_EQ(w->allocRow(), OK);
|
||||
|
||||
// Scratch buffer that will fit before inflation
|
||||
void* buf = malloc(kHalfInlineSize);
|
||||
char buf[kHalfInlineSize];
|
||||
|
||||
// Store simple value
|
||||
ASSERT_EQ(w->putLong(0, 0, 0xcafe), OK);
|
||||
@@ -322,7 +323,8 @@ TEST(CursorWindowTest, ParcelLarge) {
|
||||
ASSERT_EQ(w->putLong(0, 0, 0xcafe), OK);
|
||||
|
||||
// Store object that forces inflation
|
||||
void* buf = malloc(kGiantSize);
|
||||
std::unique_ptr<char> bufPtr(new char[kGiantSize]);
|
||||
void* buf = bufPtr.get();
|
||||
memset(buf, 42, kGiantSize);
|
||||
ASSERT_EQ(w->putBlob(0, 1, buf, kGiantSize), OK);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user