From owner-freebsd-current Tue Oct 10 10:13:49 1995 Return-Path: owner-current Received: (from root@localhost) by freefall.freebsd.org (8.6.12/8.6.6) id KAA26266 for current-outgoing; Tue, 10 Oct 1995 10:13:49 -0700 Received: from sovcom.kiae.su (sovcom.kiae.su [144.206.136.1]) by freefall.freebsd.org (8.6.12/8.6.6) with SMTP id KAA26223 for ; Tue, 10 Oct 1995 10:12:45 -0700 Received: by sovcom.kiae.su id AA03523 (5.65.kiae-1 ); Tue, 10 Oct 1995 20:01:11 +0300 Received: by sovcom.KIAE.su (UUMAIL/2.0); Tue, 10 Oct 95 20:01:11 +0300 Received: (from ache@localhost) by ache.dialup.demos.ru (8.6.11/8.6.9) id SAA08944; Tue, 10 Oct 1995 18:15:02 +0300 To: Kai.Vorma@hut.fi, current@freebsd.org References: <199510100647.IAA13033@lk-hp-4.hut.fi> In-Reply-To: <199510100647.IAA13033@lk-hp-4.hut.fi>; from Kai Vorma at Tue, 10 Oct 1995 08:47:22 +0200 Message-Id: Organization: Olahm Ha-Yetzirah Date: Tue, 10 Oct 1995 18:15:02 +0300 (MSK) X-Mailer: Mail/@ [v2.40 FreeBSD] From: =?KOI8-R?Q?=E1=CE=C4=D2=C5=CA_=FE=C5=D2=CE=CF=D7?= (aka Andrey A. Chernov, Black Mage) X-Class: Fast Subject: Re: tail dumps core Lines: 35 Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Content-Length: 1118 Sender: owner-current@freebsd.org Precedence: bulk In message <199510100647.IAA13033@lk-hp-4.hut.fi> Kai Vorma writes: >"cat file | tail" dumps core with the newest phk-malloc. This patch should >help. >*** read.c Fri May 27 15:32:45 1994 >--- read.c.ok Tue Oct 10 08:30:35 1995 >*************** >*** 142,148 **** > if ((lines = malloc(off * sizeof(*lines))) == NULL) > err(1, "%s", strerror(errno)); >! > sp = NULL; > blen = cnt = recno = wrap = 0; >--- 142,148 ---- > if ((lines = malloc(off * sizeof(*lines))) == NULL) > err(1, "%s", strerror(errno)); >! bzero(lines, off * sizeof(*lines)); > sp = NULL; > blen = cnt = recno = wrap = 0; >..vode Why not use 'calloc' instead? bzero isn't portable way. Theoretically 'calloc' can do some internal optimization of zeroing. -- Andrey A. Chernov : And I rest so composedly, /Now, in my bed, ache@astral.msk.su : That any beholder /Might fancy me dead - FidoNet: 2:5020/230.3 : Might start at beholding me, /Thinking me dead. RELCOM Team,FreeBSD Team : E.A.Poe From "For Annie" 1849