[comp.unix.wizards] free memory twice

z@rocksanne.UUCP (Jim Ziobro) (12/16/86)

The 4.3BSD awk program frees memory twice when parsing regular expressions.
This is bogus but the standard unix malloc package does not care.

Though it never mentions it in the manual malloc(3) will not break if handed
a block which was just previously free as long as there was not an intervening
malloc.  There is a comment in the awk code which hints at something like this
but it leaves a lot to be desired:
	freetr(p1);	/* add this when alloc works */

Should you be porting awk watch out for the above line!

//Z\\
Jim Ziobro
ziobro.henr@xerox.com
rocksanne!z

dph@lanl.ARPA (David P Huelsbeck) (12/18/86)

This is true of SysV and BSD4.2 also.
As far as I can tell awk has not been
changed much since 1978. (See README)

	dph@lanl.arpa
	{cmcl2,ihnp4}!lanl!dph

campbell@maynard.BSW.COM (Larry Campbell) (12/18/86)

In article <10626@lanl.ARPA> dph@LANL.ARPA (David P Huelsbeck) writes:
>This is true of SysV and BSD4.2 also.
>As far as I can tell awk has not been
>changed much since 1978. (See README)

John Bentley, in his Programming Pearls column in CACM, has made mention
of a new version of awk that allows user defined functions.  Does anyone
know if this version is available outside of AT&T?  (covet covet...)
-- 
Larry Campbell                                The Boston Software Works, Inc.
Internet: campbell@maynard.bsw.com          120 Fulton Street, Boston MA 02109
uucp: {alliant,wjh12}!maynard!campbell              +1 617 367 6846
ARPA: campbell%maynard.uucp@harvisr.harvard.edu      MCI: LCAMPBELL