I'm forwarding this to list on behalf of Richard Beebe. Please do not
include me in any responses.
>Date: Fri, 09 Apr 1999 11:26:19 -0400
>From: Rick Beebe <richard.beebe@yale.edu>
>Subject: bug(?) in swish regex
>Organization: Yale University School of Medicine
>
>I've had regular unexplained crashes in Swish 1.3.1 running under Digital
>Unix 4.0D. The crash is always a segmentation fault in matchARegex. After a
>bunch of experimentation (I haven't done anything with regex before) I added
>regfree calls to the routine and that fixed _most_ of the crashes. I'm not
>sure why it should make a difference--I would have thought re would be freed
>when leaving the routine--but it did. It still crashes occasionally--once
>every three or four days--but it never used to even make it through a night
>before.
>
>*** string.c Fri Apr 9 11:13:34 1999
>--- string.c.orig Fri Dec 11 13:33:31 1998
>***************
>*** 599,622 ****
> /*---------------------------------------------------------*/
> /* Match a regex and a string */
>
>! int matchARegex( char *str, char *pattern)
> {
> int status;
>! regex_t re;
>!
> status = regcomp(&re, pattern, REG_EXTENDED);
>! if ( status != 0) {
>! regfree(&re);
> return 0;
>! }
>!
> status = regexec(&re,str,(size_t)0,NULL,0);
>! if (status != 0) {
>! regfree(&re);
> return 0;
>! }
>!
>! regfree(&re);
> return 1;
> }
> /*-----------------------------------------------------*/
>--- 599,617 ----
> /*---------------------------------------------------------*/
> /* Match a regex and a string */
>
>! int matchARegex( char *str, char *pattern)
> {
> int status;
>! regex_t re;
>!
> status = regcomp(&re, pattern, REG_EXTENDED);
>! if ( status != 0)
> return 0;
>!
> status = regexec(&re,str,(size_t)0,NULL,0);
>! if (status != 0)
> return 0;
>!
> return 1;
> }
> /*-----------------------------------------------------*/
>
>
>--
> _______________________________________________________________________
>
> Rick Beebe (203) 785-6416
> Manager, Systems & Network Engineering FAX: (203) 785-3978
> ITS-Med Client & Technology Services Richard.Beebe@yale.edu
> Yale University School of Medicine
> P.O. Box 208078, New Haven, CT 06520-8078
> _______________________________________________________________________
>
>
Received on Fri Apr 9 13:40:14 1999