NetBSD Problem Report #3489

Received: (qmail-queue invoked from smtpd); 14 Apr 1997 08:36:37 -0000
Message-Id: <199704140843.BAA19543@epsilon.teraflop.com>
Date: Mon, 14 Apr 1997 01:43:39 -0700 (PDT)
From: Ross Harvey <ross@teraflop.com>
Reply-To: ross@teraflop.com
To: gnats-bugs@gnats.netbsd.org
Subject: fix for occasional vi(1) crash
X-Send-Pr-Version: 3.95

>Number:         3489
>Category:       bin
>Synopsis:       vi(1), fix for bad free() leading to occasional cores
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    bin-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Apr 14 01:50:01 +0000 1997
>Closed-Date:    Mon Apr 14 22:41:29 +0000 1997
>Last-Modified:  Tue Apr 15 05:41:55 +0000 1997
>Originator:     Ross Harvey
>Release:        bug is in vi 1.66
>Organization:
Avalon Computer Systems, Inc.
>Environment:

System: NetBSD epsilon.teraflop.com 1.2D NetBSD 1.2D (e) #15: Wed Apr 9 21:12:42 PDT 1997 ross@epsilon.ghs.com:/bsd/ross/e alpha


>Description:
	Patch provided for bad free() involving the tags feature of
	vi(1). Causes occasional cores having something to do with
	switching files.
>How-To-Repeat:
	It happens every couple of days for me, don't know how to
	repeat.  But I think my fix is right...someone else put
	the same fix into some post-1.66 version.
>Fix:

	Either upgrade the vi version or apply this patch...

	patch -d /usr/src/usr.bin/vi/ex


--- /bsd/base-src/usr.bin/vi/ex/ex_tag.c	Mon May 20 05:19:12 1996
+++ /usr/src/usr.bin/vi/ex/ex_tag.c	Mon Apr 14 01:24:56 1997
@@ -798,7 +798,8 @@
 		CIRCLEQ_REMOVE(&tqp->tagq, tp, q);
 		free(tp);
 	}
-	CIRCLEQ_REMOVE(&exp->tq, tqp, q);
+	if(tqp->q.cqe_next != NULL)
+		CIRCLEQ_REMOVE(&exp->tq, tqp, q);
 	free(tqp);
 	return (0);
 }
>Release-Note:
>Audit-Trail:

State-Changed-From-To: open->closed
State-Changed-By: mikel
State-Changed-When: Mon Apr 14 22:41:29 1997
State-Changed-Why:
patched as suggested, thanks.

>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.