summaryrefslogtreecommitdiffstats
path: root/hunt
diff options
context:
space:
mode:
authorwiz <wiz@NetBSD.org>2011-01-05 15:40:55 +0000
committerwiz <wiz@NetBSD.org>2011-01-05 15:40:55 +0000
commite1a671f666b695c5f1bfd34bbce01832104571f0 (patch)
tree605273e4ee73ef392eb3bad4d62966f698a744df /hunt
parentc75da9da205404a56abd711c3147a8d2296fad97 (diff)
downloadbsdgames-darwin-e1a671f666b695c5f1bfd34bbce01832104571f0.tar.gz
bsdgames-darwin-e1a671f666b695c5f1bfd34bbce01832104571f0.tar.zst
bsdgames-darwin-e1a671f666b695c5f1bfd34bbce01832104571f0.zip
Fix realloc error. Found by cppcheck.
Diffstat (limited to 'hunt')
-rw-r--r--hunt/hunt/hunt.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/hunt/hunt/hunt.c b/hunt/hunt/hunt.c
index 6db20116..2d1747b4 100644
--- a/hunt/hunt/hunt.c
+++ b/hunt/hunt/hunt.c
@@ -1,4 +1,4 @@
-/* $NetBSD: hunt.c,v 1.36 2009/08/12 07:42:11 dholland Exp $ */
+/* $NetBSD: hunt.c,v 1.37 2011/01/05 15:40:55 wiz Exp $ */
/*
* Copyright (c) 1983-2003, Regents of the University of California.
* All rights reserved.
@@ -32,7 +32,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: hunt.c,v 1.36 2009/08/12 07:42:11 dholland Exp $");
+__RCSID("$NetBSD: hunt.c,v 1.37 2011/01/05 15:40:55 wiz Exp $");
#endif /* not lint */
#include <sys/param.h>
@@ -468,8 +468,12 @@ get_response:
set[0].events = POLLIN;
for (;;) {
if (listc + 1 >= listmax) {
+ void *newlistv;
listmax += 20;
- listv = realloc(listv, listmax * sizeof(SOCKET));
+ newlistv = realloc(listv, listmax * sizeof(SOCKET));
+ if (newlistv == NULL)
+ leave(1, "realloc");
+ listv = (SOCKET *)newlistv;
}
if (poll(set, 1, 1000) == 1 &&