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
out.
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.
Modified files:
Index: src/gnu/dist/diffutils/lib/xmalloc.c
diff -u src/gnu/dist/diffutils/lib/xmalloc.c:1.1.1.1 src/gnu/dist/diffutils/lib/xmalloc.c:1.2
--- src/gnu/dist/diffutils/lib/xmalloc.c:1.1.1.1 Sat Jan 25 19:43:15 2003
+++ src/gnu/dist/diffutils/lib/xmalloc.c Mon Mar 12 13:41:59 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: xmalloc.c,v 1.1.1.1 2003/01/26 00:43:15 wiz Exp $ */
+/* $NetBSD: xmalloc.c,v 1.2 2012/03/12 17:41:59 christos Exp $ */
/* xmalloc.c -- malloc with out of memory checking
Copyright (C) 1990-1999, 2000, 2002 Free Software Foundation, Inc.
@@ -84,7 +84,7 @@ xmalloc (size_t n)
void *p;
p = malloc (n);
- if (p == 0)
+ if (p == 0 && n)
xalloc_die ();
return p;
}
@@ -96,7 +96,7 @@ void *
xrealloc (void *p, size_t n)
{
p = realloc (p, n);
- if (p == 0)
+ if (p == 0 && n)
xalloc_die ();
return p;
}
@@ -109,7 +109,7 @@ xcalloc (size_t n, size_t s)
void *p;
p = calloc (n, s);
- if (p == 0)
+ if (p == 0 && n && s)
xalloc_die ();
return p;
}