Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/gnu/dist/diffutils/lib PR/26453: Ken Raeburn: make zero byte...
details: https://anonhg.NetBSD.org/src/rev/8cf9cb8807e7
branches: trunk
changeset: 778014:8cf9cb8807e7
user: christos <christos%NetBSD.org@localhost>
date: Mon Mar 12 17:41:59 2012 +0000
description:
PR/26453: Ken Raeburn: make zero byte allocations return NULL instead of error
out.
diffstat:
gnu/dist/diffutils/lib/xmalloc.c | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diffs (36 lines):
diff -r 985c9ec7e6ab -r 8cf9cb8807e7 gnu/dist/diffutils/lib/xmalloc.c
--- a/gnu/dist/diffutils/lib/xmalloc.c Mon Mar 12 16:37:15 2012 +0000
+++ b/gnu/dist/diffutils/lib/xmalloc.c Mon Mar 12 17:41:59 2012 +0000
@@ -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 @@
void *p;
p = malloc (n);
- if (p == 0)
+ if (p == 0 && n)
xalloc_die ();
return p;
}
@@ -96,7 +96,7 @@
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 @@
void *p;
p = calloc (n, s);
- if (p == 0)
+ if (p == 0 && n && s)
xalloc_die ();
return p;
}
Home |
Main Index |
Thread Index |
Old Index