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/>. */
25 #include <support/support.h>
26 #include <support/check.h>
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
);
40 TEST_COMPARE (malloc_usable_size (NULL
), 0);
45 #include "support/test-driver.c"