Back to index

glibc  2.9
bug-regex15.c
Go to the documentation of this file.
00001 /* Test for memory/CPU leak in regcomp.  */
00002 
00003 #include <error.h>
00004 #include <sys/types.h>
00005 #include <regex.h>
00006 #include <stdio.h>
00007 #include <stdlib.h>
00008 
00009 #define TEST_DATA_LIMIT (32 << 20)
00010 
00011 static int do_test (void);
00012 #define TEST_FUNCTION do_test ()
00013 #include "../test-skeleton.c"
00014 
00015 static int
00016 do_test (void)
00017 {
00018   regex_t re;
00019   int reerr;
00020 
00021   reerr = regcomp (&re, "^6?3?[25]?5?[14]*[25]*[69]*+[58]*87?4?$",
00022                  REG_EXTENDED | REG_NOSUB);
00023   if (reerr != 0)
00024     {
00025       char buf[100];
00026       regerror (reerr, &re, buf, sizeof buf);
00027       printf ("regerror %s\n", buf);
00028       return 1;
00029     }
00030 
00031   return 0;
00032 }