Skip to content

test: Avoid use-after-free

Matt Turner requested to merge mattst88/libxmu:avoid-use-after-free into master

p was the pointer given to Xmureallocarray. p2 is the return value.

reallocarray.c: In function ‘test_Xmureallocarray_oversize’:
reallocarray.c:162:5: warning: pointer ‘p’ used after ‘realloc’ [-Wuse-after-free]
  162 |     free(p);
      |     ^~~~~~~

Fixes: 35eb34a9 ("test: Add simple test cases for functions in src/reallocarray.c")

Edited by Matt Turner

Merge request reports