summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2019-08-11 14:41:50 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2019-08-11 14:41:50 +0000
commit8d65a12cffb05421cd9d7ff2aae260a25165d97b (patch)
tree4bb79a02083d4e17699aeb59cadc93d6b67434b4
parent99b7402f0592fd8aef8d1b21d82596a16036fcd0 (diff)
error if malloc fails; ok martijn
-rw-r--r--usr.bin/snmp/snmpc.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/usr.bin/snmp/snmpc.c b/usr.bin/snmp/snmpc.c
index a25928321d0..9fa0954ada1 100644
--- a/usr.bin/snmp/snmpc.c
+++ b/usr.bin/snmp/snmpc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: snmpc.c,v 1.2 2019/08/11 14:41:20 deraadt Exp $ */
+/* $OpenBSD: snmpc.c,v 1.3 2019/08/11 14:41:49 deraadt Exp $ */
/*
* Copyright (c) 2019 Martijn van Duren <martijn@openbsd.org>
@@ -317,6 +317,8 @@ snmpc_get(int argc, char *argv[])
argv++;
oid = reallocarray(NULL, argc, sizeof(*oid));
+ if (oid == NULL)
+ err(1, "malloc");
for (i = 0; i < argc; i++) {
if (smi_string2oid(argv[i], &oid[i]) == -1)
errx(1, "%s: Unknown object identifier", argv[0]);