1// Licensed to the .NET Foundation under one or more agreements.
2// The .NET Foundation licenses this file to you under the MIT license.
3// See the LICENSE file in the project root for more information.
4
5/*============================================================================
6**
7** Source: test2.c
8**
9** Purpose: Test that malloc(0) returns non-zero value
10**
11**==========================================================================*/
12
13#include <palsuite.h>
14
15
16int __cdecl main(int argc, char **argv)
17{
18
19 char *testA;
20
21 if (PAL_Initialize(argc, argv))
22 {
23 return FAIL;
24 }
25
26 /* check that malloc(0) returns non-zero value */
27 testA = (char *)malloc(0);
28 if (testA == NULL)
29 {
30 Fail("Call to malloc(0) failed.\n");
31 }
32
33 free(testA);
34
35 PAL_Terminate();
36
37 return PASS;
38}
39
40
41
42