Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!decwrl!sun!pitstop!sundc!rlgvax!dennis From: dennis@rlgvax.UUCP (Dennis.Bednar) Newsgroups: comp.sources.d Subject: gnu egrep - realloc of 0 bytes caused failure: Memory exhausted Message-ID: <1114@rlgvax.UUCP> Date: 15 Feb 89 08:32:13 GMT Organization: Computer Consoles Inc, Reston VA Lines: 25 The GNU version of egrep failed to work on a CCI 6/32 running Unix SV. The bug was traced to the fact that realloc(p, n) was being called with n==0, given the command line "grep abc". I did not have time to track down the gory details as to why realloc was being called with 0, nor why it supposedly works on other machines (assuming that realloc is called with 0 on other machines). To fix the problem temporarily, in dfa.c, in the function xrealloc(), change: ptr_t r = realloc(p, n); to ptr_t r = realloc(p, ( n ) ? n : 50); so that a dummy 50 byte realloc would be done if the size were zero. Without the change, our realloc() library routine was returning char *NULL, causing a "Memory exhausted" message. Comments from the authors? -dennis -- FullName: Dennis Bednar UUCP: {uunet|sundc}!rlgvax!dennis USMail: CCI; 11490 Commerce Park Dr.; Reston VA 22091 Telephone: +1 703 648 3300