mirror of
https://github.com/TinyCC/tinycc.git
synced 2025-11-16 12:34:45 +00:00
Fix tests/boundtest.c
The test leaks memory on arm/arm64/riscv because alloca is replaced by malloc and the memory is not freed for test16 and test17.
This commit is contained in:
@@ -204,14 +204,15 @@ int test15(void)
|
|||||||
int test16()
|
int test16()
|
||||||
{
|
{
|
||||||
char *demo = "This is only a test.";
|
char *demo = "This is only a test.";
|
||||||
char *p;
|
char *p, *q;
|
||||||
|
|
||||||
p = alloca(16);
|
p = alloca(16);
|
||||||
strcpy(p,"12345678901234");
|
strcpy(p,"12345678901234");
|
||||||
|
|
||||||
/* Test alloca embedded in a larger expression */
|
/* Test alloca embedded in a larger expression */
|
||||||
printf("alloca : %s : %s\n", p, strcpy(alloca(strlen(demo)+1),demo) );
|
printf("alloca : %s : %s\n", p, strcpy(q=alloca(strlen(demo)+1),demo) );
|
||||||
allocf(p);
|
allocf(p);
|
||||||
|
allocf(q);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -220,14 +221,15 @@ int test16()
|
|||||||
int test17()
|
int test17()
|
||||||
{
|
{
|
||||||
char *demo = "This is only a test.";
|
char *demo = "This is only a test.";
|
||||||
char *p;
|
char *p, *q;
|
||||||
|
|
||||||
p = alloca(16);
|
p = alloca(16);
|
||||||
strcpy(p,"12345678901234");
|
strcpy(p,"12345678901234");
|
||||||
|
|
||||||
/* Test alloca embedded in a larger expression */
|
/* Test alloca embedded in a larger expression */
|
||||||
printf("alloca : %s : %s\n", p, strcpy(alloca(strlen(demo)),demo) );
|
printf("alloca : %s : %s\n", p, strcpy(q=alloca(strlen(demo)),demo) );
|
||||||
allocf(p);
|
allocf(p);
|
||||||
|
allocf(q);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user