summaryrefslogtreecommitdiff
path: root/test/fuzzer/AccumulateAllocationsTest.cpp
blob: e9acd7ccbd30fb05627dbd9398e78c20656238cd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.

// Test with a more mallocs than frees, but no leak.
#include <cstddef>
#include <cstdint>

const int kAllocatedPointersSize = 10000;
int NumAllocatedPointers = 0;
int *AllocatedPointers[kAllocatedPointersSize];

extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
  if (NumAllocatedPointers < kAllocatedPointersSize)
    AllocatedPointers[NumAllocatedPointers++] = new int;
  return 0;
}