summaryrefslogtreecommitdiff
path: root/lib/libagentx
diff options
context:
space:
mode:
authorMartijn van Duren <martijn@cvs.openbsd.org>2020-10-26 19:02:31 +0000
committerMartijn van Duren <martijn@cvs.openbsd.org>2020-10-26 19:02:31 +0000
commit2993d8e7670ad2a7833c9b698e8a42329d0acdd2 (patch)
tree970cb17c04e3bd361b44adffeda4567bcb57d551 /lib/libagentx
parent53845c4465a947511f843e5f437e3eb4f126d879 (diff)
Set ax_rbsize before calling malloc and use it in malloc.
OK tb@ and kn@
Diffstat (limited to 'lib/libagentx')
-rw-r--r--lib/libagentx/ax.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/libagentx/ax.c b/lib/libagentx/ax.c
index 40c7adf7fb8..309c756f23b 100644
--- a/lib/libagentx/ax.c
+++ b/lib/libagentx/ax.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ax.c,v 1.2 2020/10/26 16:02:16 tb Exp $ */
+/* $OpenBSD: ax.c,v 1.3 2020/10/26 19:02:30 martijn Exp $ */
/*
* Copyright (c) 2019 Martijn van Duren <martijn@openbsd.org>
*
@@ -69,9 +69,9 @@ ax_new(int fd)
if ((ax = calloc(1, sizeof(*ax))) == NULL)
return NULL;
ax->ax_fd = fd;
- if ((ax->ax_rbuf = malloc(512)) == NULL)
- goto fail;
ax->ax_rbsize = 512;
+ if ((ax->ax_rbuf = malloc(ax->ax_rbsize)) == NULL)
+ goto fail;
ax->ax_byteorder = AX_BYTE_ORDER_NATIVE;
return ax;