elf: Add comments on how LD_AUDIT and LD_PRELOAD handle __libc_enable_secure
[glibc.git] / malloc / tst-malloc-usable.c
blob05492daf89cea95360ccbec8d9407062d05867fd
1 /* Ensure that malloc_usable_size returns the request size with
2 MALLOC_CHECK_ exported to a positive value.
4 Copyright (C) 2012-2023 Free Software Foundation, Inc.
5 Copyright The GNU Toolchain Authors.
6 This file is part of the GNU C Library.
8 The GNU C Library is free software; you can redistribute it and/or
9 modify it under the terms of the GNU Lesser General Public
10 License as published by the Free Software Foundation; either
11 version 2.1 of the License, or (at your option) any later version.
13 The GNU C Library is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 Lesser General Public License for more details.
18 You should have received a copy of the GNU Lesser General Public
19 License along with the GNU C Library; if not, see
20 <https://www.gnu.org/licenses/>. */
22 #include <malloc.h>
23 #include <string.h>
24 #include <stdio.h>
25 #include <support/support.h>
26 #include <support/check.h>
28 static int
29 do_test (void)
31 size_t usable_size;
32 void *p = malloc (7);
34 TEST_VERIFY_EXIT (p != NULL);
35 usable_size = malloc_usable_size (p);
36 TEST_COMPARE (usable_size, 7);
37 memset (p, 0, usable_size);
38 free (p);
40 TEST_COMPARE (malloc_usable_size (NULL), 0);
42 return 0;
45 #include "support/test-driver.c"