mirror of https://git.tukaani.org/xz.git
Tests: tuktest.h: Support tuktest_malloc(0).
It's not needed in XZ Utils at least for now. It's good to support it still because if such use is needed later, it wouldn't be caught on GNU/Linux since malloc(0) from glibc returns non-NULL.
This commit is contained in:
parent
ce3a3fbc7c
commit
1bbefa9659
|
@ -2,7 +2,7 @@
|
||||||
//
|
//
|
||||||
/// \file tuktest.h
|
/// \file tuktest.h
|
||||||
/// \brief Helper macros for writing simple test programs
|
/// \brief Helper macros for writing simple test programs
|
||||||
/// \version 2022-06-16
|
/// \version 2023-01-08
|
||||||
///
|
///
|
||||||
/// Some inspiration was taken from STest by Keith Nicholas.
|
/// Some inspiration was taken from STest by Keith Nicholas.
|
||||||
///
|
///
|
||||||
|
@ -349,7 +349,7 @@ static struct tuktest_malloc_record *tuktest_malloc_global = NULL;
|
||||||
static void *
|
static void *
|
||||||
tuktest_malloc_impl(size_t size, const char *filename, unsigned line)
|
tuktest_malloc_impl(size_t size, const char *filename, unsigned line)
|
||||||
{
|
{
|
||||||
void *p = malloc(size);
|
void *p = malloc(size == 0 ? 1 : size);
|
||||||
struct tuktest_malloc_record *r = malloc(sizeof(*r));
|
struct tuktest_malloc_record *r = malloc(sizeof(*r));
|
||||||
|
|
||||||
if (p == NULL || r == NULL) {
|
if (p == NULL || r == NULL) {
|
||||||
|
|
Loading…
Reference in New Issue