NetBSD Problem Report #26453

Received: (qmail 17700 invoked by uid 605); 27 Jul 2004 21:52:59 -0000
Message-Id: <>
Date: Tue, 27 Jul 2004 19:28:50 +0000 (UTC)
Subject: diff "out of memory" trying to allocate 0 with malloc option "V"
X-Send-Pr-Version: www-1.0

>Number:         26453
>Category:       bin
>Synopsis:       diff "out of memory" trying to allocate 0 with malloc option "V"
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Jul 27 21:54:00 +0000 2004
>Closed-Date:    Tue Mar 13 05:40:49 +0000 2012
>Last-Modified:  Tue Mar 13 05:40:49 +0000 2012
>Originator:     Ken Raeburn
>Release:        2.0 branch approx 7/27/2004
NetBSD 2.0_BETA NetBSD 2.0_BETA (GENERIC) #0: Sun Jul 18 00:45:57 EDT 2004 alpha

When I run diff on two copies of t_prng.expected from the MIT Kerberos distribution, diff claims that it's run out of memory.  In fact, it's calling malloc(0), and the NULL return value (MALLOC_OPTIONS is "AJRVX<<") is causing confusion.

The test jm_FUNC_MALLOC -- ignore the description of determining whether malloc "works" -- checks for malloc(0) returning non-null values, and a "replacement" is used if it does.

env MALLOC_OPTIONS=V diff /tmp/a /tmp/b
where a and b are both the four-line file:

(I hope that copy of the file comes through okay.)
Use the replacement function always.

Set MALLOC_OPTIONS to include "V" when running configure scripts to come up with config.h files to check in (assuming that's how they're produced).
From: "Jukka Ruohonen" <>
Subject: PR/26453 CVS commit: src
Date: Tue, 3 May 2011 15:13:51 +0000

 Module Name:	src
 Committed By:	jruoho
 Date:		Tue May  3 15:13:51 UTC 2011

 Modified Files:
 	src/distrib/sets/lists/tests: mi
 	src/etc/mtree: NetBSD.dist.tests
 	src/tests/usr.bin: Makefile
 Added Files:
 	src/tests/usr.bin/diff: Makefile

 Log Message:
 Add a test case for PR bin/26453.

 To generate a diff of this commit:
 cvs rdiff -u -r1.325 -r1.326 src/distrib/sets/lists/tests/mi
 cvs rdiff -u -r1.45 -r1.46 src/etc/mtree/NetBSD.dist.tests
 cvs rdiff -u -r1.4 -r1.5 src/tests/usr.bin/Makefile
 cvs rdiff -u -r0 -r1.1 src/tests/usr.bin/diff/Makefile \
     src/tests/usr.bin/diff/ src/tests/usr.bin/diff/ \

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: "Christos Zoulas" <>
Subject: PR/26453 CVS commit: src/gnu/dist/diffutils/lib
Date: Mon, 12 Mar 2012 13:41:59 -0400

 Module Name:	src
 Committed By:	christos
 Date:		Mon Mar 12 17:41:59 UTC 2012

 Modified Files:
 	src/gnu/dist/diffutils/lib: xmalloc.c

 Log Message:
 PR/26453: Ken Raeburn: make zero byte allocations return NULL instead of error

 To generate a diff of this commit:
 cvs rdiff -u -r1.1.1.1 -r1.2 src/gnu/dist/diffutils/lib/xmalloc.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: open->closed
State-Changed-When: Tue, 13 Mar 2012 05:40:49 +0000

Fixed and fix confirmed by the test runs.


NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD:,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.