Skip to content

Commit

Permalink
[HWASAN] Fix a memory leak in realloc-test.cpp
Browse files Browse the repository at this point in the history
Reviewed By: vitalybuka

Differential Revision: https://reviews.llvm.org/D146180
  • Loading branch information
kstoimenov committed Mar 16, 2023
1 parent ce455f4 commit 55ceb2e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion compiler-rt/test/hwasan/TestCases/realloc-test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@

#include <assert.h>
#include <sanitizer/hwasan_interface.h>
#include <stdlib.h>

#ifdef REALLOCARRAY
extern "C" void *reallocarray(void *, size_t nmemb, size_t size);
#define REALLOC(p, s) reallocarray(p, 1, s)
#else
#include <stdlib.h>
#define REALLOC(p, s) realloc(p, s)
#endif

Expand Down Expand Up @@ -41,4 +41,5 @@ int main() {
assert(x4 != x3);
assert(x4[0] == 10 && x4[1] == 20 && x4[2] == 30 && x4[3] == 40 &&
x4[4] == 50);
free(x4);
}

0 comments on commit 55ceb2e

Please sign in to comment.