Module Name: src Committed By: wiz Date: Wed Jan 5 15:40:55 UTC 2011
Modified Files: src/games/hunt/hunt: hunt.c Log Message: Fix realloc error. Found by cppcheck. To generate a diff of this commit: cvs rdiff -u -r1.36 -r1.37 src/games/hunt/hunt/hunt.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/games/hunt/hunt/hunt.c diff -u src/games/hunt/hunt/hunt.c:1.36 src/games/hunt/hunt/hunt.c:1.37 --- src/games/hunt/hunt/hunt.c:1.36 Wed Aug 12 07:42:11 2009 +++ src/games/hunt/hunt/hunt.c Wed Jan 5 15:40:55 2011 @@ -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 @@ 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 &&