diff --git a/libc/malloc_debug/RecordData.h b/libc/malloc_debug/RecordData.h index 484d73b9a..a02c956da 100644 --- a/libc/malloc_debug/RecordData.h +++ b/libc/malloc_debug/RecordData.h @@ -109,7 +109,7 @@ class FreeEntry : public AllocEntry { class CallocEntry : public MallocEntry { public: - CallocEntry(void* pointer, size_t size, size_t nmemb, uint64_t st, uint64_t et); + CallocEntry(void* pointer, size_t nmemb, size_t size, uint64_t st, uint64_t et); virtual ~CallocEntry() = default; bool Write(int fd) const override; diff --git a/libc/malloc_debug/malloc_debug.cpp b/libc/malloc_debug/malloc_debug.cpp index 7c6824294..4bc5649e2 100644 --- a/libc/malloc_debug/malloc_debug.cpp +++ b/libc/malloc_debug/malloc_debug.cpp @@ -943,7 +943,7 @@ void* debug_calloc(size_t nmemb, size_t bytes) { if (g_debug->config().options() & RECORD_ALLOCS) { g_debug->record->AddEntry( - new CallocEntry(pointer, bytes, nmemb, result.GetStartTimeNS(), result.GetEndTimeNS())); + new CallocEntry(pointer, nmemb, bytes, result.GetStartTimeNS(), result.GetEndTimeNS())); } if (pointer != nullptr && g_debug->TrackPointers()) { diff --git a/libc/malloc_debug/tests/malloc_debug_unit_tests.cpp b/libc/malloc_debug/tests/malloc_debug_unit_tests.cpp index 621537944..bf3ed1461 100644 --- a/libc/malloc_debug/tests/malloc_debug_unit_tests.cpp +++ b/libc/malloc_debug/tests/malloc_debug_unit_tests.cpp @@ -2196,7 +2196,7 @@ void VerifyRecordAllocs(const std::string& record_filename) { debug_free(pointer); expected.push_back(android::base::StringPrintf("%d: free %p", getpid(), pointer)); - pointer = debug_calloc(1, 20); + pointer = debug_calloc(20, 1); ASSERT_TRUE(pointer != nullptr); expected.push_back(android::base::StringPrintf("%d: calloc %p 20 1", getpid(), pointer)); debug_free(pointer);