Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 9 Aug 1997 20:07:55 +0400 (MSD)
From:      Dmitrij Tejblum <dima@tejblum.dnttm.rssi.ru>
To:        FreeBSD-gnats-submit@FreeBSD.ORG
Subject:   bin/4254: make in free(): warning: chunk is already free
Message-ID:  <199708091607.UAA18642@tejblum.dnttm.rssi.ru>
Resent-Message-ID: <199708091610.JAA29903@hub.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         4254
>Category:       bin
>Synopsis:       make in free(): warning: chunk is already free
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat Aug  9 09:10:01 PDT 1997
>Last-Modified:
>Originator:     Dmitrij Tejblum
>Organization:
>Release:        FreeBSD 3.0-CURRENT-src-cur-2995 i386
>Environment:


>Description:

When all transformation rules to or from a suffix disappeared, make tries 
to free the suffix. I think, it is a very strange idea. (Or, maybe, it is a 
POSIX requirement?) And it is done incorrectly. Apparently, it even don't 
update the list of known suffixes (but it is an other bug).

>How-To-Repeat:

Try following Makefile:

-----------------------cut here----------
.SUFFIXES: .xxx

.xxx.c:

aaaa: bbbbb 
------------------------cut here---------

>Fix:
	
--- suff.c.00	Wed Mar 12 12:44:53 1997
+++ suff.c	Sat Aug  9 19:26:04 1997
@@ -160,7 +160,6 @@
 static int SuffSuffHasNameP __P((ClientData, ClientData));
 static int SuffSuffIsPrefix __P((ClientData, ClientData));
 static int SuffGNHasNameP __P((ClientData, ClientData));
-static void SuffUnRef __P((ClientData, ClientData));
 static void SuffFree __P((ClientData));
 static void SuffInsert __P((Lst, Suff *));
 static void SuffRemove __P((Lst, Suff *));
@@ -327,20 +326,6 @@
 
  	    /*********** Maintenance Functions ************/
 
-static void
-SuffUnRef(lp, sp)
-    ClientData lp;
-    ClientData sp;
-{
-    Lst l = (Lst) lp;
-
-    LstNode ln = Lst_Member(l, sp);
-    if (ln != NILLNODE) {
-	Lst_Remove(l, ln);
-	((Suff *) sp)->refCount--;
-    }
-}
-
 /*-
  *-----------------------------------------------------------------------
  * SuffFree  --
@@ -383,8 +368,7 @@
  *	None
  *
  * Side Effects:
- *	The reference count for the suffix is decremented and the
- *	suffix is possibly freed
+ *	The reference count for the suffix is decremented
  *-----------------------------------------------------------------------
  */
 static void
@@ -392,9 +376,11 @@
     Lst l;
     Suff *s;
 {
-    SuffUnRef((ClientData) l, (ClientData) s);
-    if (s->refCount == 0)
-	SuffFree((ClientData) s);
+    LstNode ln = Lst_Member(l, (ClientData)s);
+    if (ln != NILLNODE) {
+	Lst_Remove(l, ln);
+	s->refCount--;
+    }
 }
 
 /*-

>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199708091607.UAA18642>