Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!apple!gem.mps.ohio-state.edu!tut.cis.ohio-state.edu!CS.COLUMBIA.EDU!dupuy From: dupuy@CS.COLUMBIA.EDU (Alexander Dupuy) Newsgroups: gnu.utils.bug Subject: Wrong memory freed in GNUmake 3.55 Message-ID: <8909272019.AA08798@cs.columbia.edu> Date: 27 Sep 89 20:19:00 GMT Sender: daemon@tut.cis.ohio-state.edu Reply-To: dupuy@cs.columbia.edu Distribution: gnu Organization: GNUs Not Usenet Lines: 79 > From: davida@isil.ai.mit.edu (David Axmark) > Newsgroups: gnu.utils.bug > Another smaller bug. > If patsubst is used without a % in the pattern as in the following makefile. > all:; echo $(patsubst /,, $(dir doo/ddd)) > On my system make loops on this makefile and takes all my memory... Here's a fix, which includes your patches to function.c (yours were reversed normal diffs - context diffs are preferable). The first hunk is the fix for looping, the rest are your fix for freeing wrong memory. RCS file: src/RCS/function.c,v retrieving revision 3.56 diff -c -r3.56 src/function.c *** /tmp/,RCSt1a08524 Wed Sep 27 16:14:13 1989 --- src/function.c Wed Sep 27 15:49:59 1989 *************** *** 67,73 **** /* Struck out. Output the rest of the string that is no longer to be replaced. */ o = variable_buffer_output (o, subst, slen); ! continue; } /* Advance T past the string to be replaced. */ --- 67,75 ---- /* Struck out. Output the rest of the string that is no longer to be replaced. */ o = variable_buffer_output (o, subst, slen); ! /* Advance T past the string to be replaced. */ ! t = p + slen; ! continue; } /* Advance T past the string to be replaced. */ *************** *** 860,866 **** BADARGS ("word"); text = expand_argument (text, p); ! p = expand_argument (p + 1, end); /* Check the first argument. */ for (p2 = text; *p2 != '\0'; ++p2) --- 862,869 ---- BADARGS ("word"); text = expand_argument (text, p); ! p3 = expand_argument (p + 1, end); ! p = p3; /* Check the first argument. */ for (p2 = text; *p2 != '\0'; ++p2) *************** *** 881,887 **** o = variable_buffer_output (o, p, len); free (text); ! free (p); break; case function_words: --- 884,890 ---- o = variable_buffer_output (o, p, len); free (text); ! free (p3); break; case function_words: @alex -- inet: dupuy@cs.columbia.edu uucp: ...!rutgers!cs.columbia.edu!dupuy