summaryrefslogtreecommitdiff
path: root/usr.sbin/lpr/common_source
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2014-10-16 04:17:49 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2014-10-16 04:17:49 +0000
commit39769eb3a9bc371266fd83bf46560e6b45ba4463 (patch)
tree20db970e1e40a40beb79ffca9bdf3e29a6cadc75 /usr.sbin/lpr/common_source
parent3ee078447c783f4e6a4115033dd8d67cb1ea6144 (diff)
reallocarray() obviously
Diffstat (limited to 'usr.sbin/lpr/common_source')
-rw-r--r--usr.sbin/lpr/common_source/common.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/usr.sbin/lpr/common_source/common.c b/usr.sbin/lpr/common_source/common.c
index 10b293d75fb..bf764c81a43 100644
--- a/usr.sbin/lpr/common_source/common.c
+++ b/usr.sbin/lpr/common_source/common.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: common.c,v 1.35 2013/12/10 16:38:04 naddy Exp $ */
+/* $OpenBSD: common.c,v 1.36 2014/10/16 04:17:48 deraadt Exp $ */
/* $NetBSD: common.c,v 1.21 2000/08/09 14:28:50 itojun Exp $ */
/*
@@ -270,15 +270,14 @@ getq(struct queue ***namelist)
*/
if (nitems == arraysz) {
struct queue **newqueue;
- size_t newarraysz = arraysz * 2;
- newqueue = (struct queue **)realloc(queue,
- newarraysz * sizeof(struct queue *));
+ newqueue = reallocarray(queue,
+ arraysz, 2 * sizeof(struct queue *));
if (newqueue == NULL) {
free(q);
goto errdone;
}
+ arraysz *= 2;
queue = newqueue;
- arraysz = newarraysz;
}
queue[nitems++] = q;
}