diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2014-10-16 04:17:49 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2014-10-16 04:17:49 +0000 |
commit | 39769eb3a9bc371266fd83bf46560e6b45ba4463 (patch) | |
tree | 20db970e1e40a40beb79ffca9bdf3e29a6cadc75 /usr.sbin | |
parent | 3ee078447c783f4e6a4115033dd8d67cb1ea6144 (diff) |
reallocarray() obviously
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/lpr/common_source/common.c | 9 |
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; } |