Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/lib/librumphijack Don't depend on malloc(0) returning non-NULL.
details: https://anonhg.NetBSD.org/src/rev/324d30c3b1fb
branches: trunk
changeset: 760619:324d30c3b1fb
user: pooka <pooka%NetBSD.org@localhost>
date: Sun Jan 09 14:15:06 2011 +0000
description:
Don't depend on malloc(0) returning non-NULL.
diffstat:
lib/librumphijack/hijack.c | 14 +++++++++-----
1 files changed, 9 insertions(+), 5 deletions(-)
diffs (35 lines):
diff -r 5eced77850b2 -r 324d30c3b1fb lib/librumphijack/hijack.c
--- a/lib/librumphijack/hijack.c Sun Jan 09 14:12:37 2011 +0000
+++ b/lib/librumphijack/hijack.c Sun Jan 09 14:15:06 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: hijack.c,v 1.5 2011/01/09 10:28:46 pooka Exp $ */
+/* $NetBSD: hijack.c,v 1.6 2011/01/09 14:15:06 pooka Exp $ */
/*-
* Copyright (c) 2011 Antti Kantee. All Rights Reserved.
@@ -26,7 +26,7 @@
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: hijack.c,v 1.5 2011/01/09 10:28:46 pooka Exp $");
+__RCSID("$NetBSD: hijack.c,v 1.6 2011/01/09 14:15:06 pooka Exp $");
#include <sys/param.h>
#include <sys/types.h>
@@ -627,9 +627,13 @@
}
}
- pfds = malloc(sizeof(*pfds) * realnfds);
- if (!pfds)
- return -1;
+ if (realnfds) {
+ pfds = malloc(sizeof(*pfds) * realnfds);
+ if (!pfds)
+ return -1;
+ } else {
+ pfds = NULL;
+ }
for (i = 0, j = 0; i < nfds; i++) {
incr = 0;
Home |
Main Index |
Thread Index |
Old Index