Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
2002-12-13 Roland McGrath <roland@redhat.com>
* posix/bug-regex15.c: New file. * posix/Makefile (tests): Add it.
- Loading branch information
Roland McGrath
committed
Dec 13, 2002
1 parent
d94e16c
commit afc58fa
Showing
2 changed files
with
33 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/* Test for memory/CPU leak in regcomp. */ | ||
|
||
#include <error.h> | ||
#include <sys/types.h> | ||
#include <regex.h> | ||
#include <stdio.h> | ||
#include <stdlib.h> | ||
|
||
#define TEST_DATA_LIMIT (32 << 20) | ||
|
||
static int do_test (void); | ||
#define TEST_FUNCTION do_test () | ||
#include "../test-skeleton.c" | ||
|
||
static int | ||
do_test (void) | ||
{ | ||
regex_t re; | ||
int reerr; | ||
|
||
reerr = regcomp (&re, "^6?3?[25]?5?[14]*[25]*[69]*+[58]*87?4?$", | ||
REG_EXTENDED | REG_NOSUB); | ||
if (reerr != 0) | ||
{ | ||
char buf[100]; | ||
regerror (reerr, &re, buf, sizeof buf); | ||
printf ("regerror %s\n", buf); | ||
return 1; | ||
} | ||
|
||
return 0; | ||
} |