summaryrefslogtreecommitdiff
path: root/tests/malloc.c
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff.email>2026-03-10 13:24:07 +0100
committerJörg Frings-Fürst <debian@jff.email>2026-03-10 13:24:07 +0100
commitcfd1f17f1a85d95ea12bca8dae42add7dad1ad11 (patch)
tree8016486f8ee7157213f2d09ff2491bfa9c94638a /tests/malloc.c
parent14e4d584d0121031ec40e6c35869745f1747ff29 (diff)
parent1403307d6e2fb4e7b5d97a35f40d1e95134561ab (diff)
Merge branch 'release/debian/1.4.2-1'HEADdebian/1.4.2-1master
Diffstat (limited to 'tests/malloc.c')
-rw-r--r--tests/malloc.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/tests/malloc.c b/tests/malloc.c
index 2a7867a1..f7d11921 100644
--- a/tests/malloc.c
+++ b/tests/malloc.c
@@ -1,6 +1,6 @@
/* malloc() function that is glibc compatible.
- Copyright (C) 1997-1998, 2006-2007, 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 1997-1998, 2006-2007, 2009-2026 Free Software Foundation, Inc.
This file is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
@@ -17,28 +17,33 @@
/* written by Jim Meyering and Bruno Haible */
+/* Ensure that we call the system's malloc() below. */
#define _GL_USE_STDLIB_ALLOC 1
#include <config.h>
#include <stdlib.h>
#include <errno.h>
-
-#include "xalloc-oversized.h"
+#include <stdckdint.h>
/* Allocate an N-byte block of memory from the heap, even if N is 0. */
void *
rpl_malloc (size_t n)
{
+#if !HAVE_MALLOC_0_NONNULL
if (n == 0)
n = 1;
+#endif
- if (xalloc_oversized (n, 1))
+#if !HAVE_MALLOC_PTRDIFF
+ ptrdiff_t signed_n;
+ if (ckd_add (&signed_n, n, 0))
{
errno = ENOMEM;
return NULL;
}
+#endif
void *result = malloc (n);