Bug 7821 - awk in free(): warning: chunk is already free.
Summary: awk in free(): warning: chunk is already free.
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: gnu (show other bugs)
Version: 3.0-CURRENT
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 1998-09-03 18:30 UTC by Alexander Litvin
Modified: 1999-12-21 14:54 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alexander Litvin 1998-09-03 18:30:00 UTC
The problem first appeared when GNU awk in 3.0-CURRENT was apgraded to
3.0.3. I run C-News, which uses awk extensively. After awk apgrade C-News
expire stopped to work. It appeared that some GNU awk 3.0.3 programms when
given absolutely legitimate input fail, giving out a number of messages:

awk in free(): warning: chunk is already free.

Fix: 

I was not able to track the error in awk sources. As a workaround,
I just reverted to GNU awk 2.15.5.
How-To-Repeat: 
Run the following awk program (it is cut out of C-News expire scripts).
I was not able to cut it down more -- omitting some portions of the
code (e.g. OFMT line), make error go away in this case, though it
certainly does not fix awk.

----------------cut-here----------------
#!/usr/bin/awk -f
BEGIN {
	OFMT = "%.12g"
	big = 99999999999
	lowest = big
	small = 0
	highest = small
}

$0 ~ /^[0-9]+$/ {
	if ($1 < lowest)
		lowest = $1
	if ($1 > highest)
		highest = $1
	next
}

$0 ~ /^[a-z]+/ {
	print dir, highest, lowest
	dir = $0
	lowest = big
	highest = small
}
----------------cut-here----------------

To get the error, just give this script the following input:
----------------cut-here----------------
a
1
b
----------------cut-here----------------
Comment 1 Poul-Henning Kamp freebsd_committer freebsd_triage 1998-09-17 10:04:08 UTC
State Changed
From-To: open->suspended

reported to GNU maintainer. 

Comment 2 hoek freebsd_committer freebsd_triage 1999-08-03 02:12:46 UTC
>
>The problem first appeared when GNU awk in 3.0-CURRENT was apgraded to
>3.0.3. I run C-News, which uses awk extensively. After awk apgrade C-News

See also gnu/12935.
Comment 3 hoek freebsd_committer freebsd_triage 1999-08-03 02:21:12 UTC
>          
>I was not able to track the error in awk sources. As a workaround,
>I just reverted to GNU awk 2.15.5.

More complete list of See-Also's: gnu/9281, gnu/10555, gnu/7821
Comment 4 Sheldon Hearn freebsd_committer freebsd_triage 1999-12-21 14:54:07 UTC
State Changed
From-To: suspended->closed

Our gawk was upgraded to 3.0.4 in CURRENT a while ago and merged in 
time for 3.4-RELEASE.