$OpenBSD: patch-apps_snmpps_c,v 1.2 2020/02/21 15:14:58 sthen Exp $

OpenBSD snmpd doesn't support HOST-RESOURCES-MIB::hrSWRunPerfMem /
HOST-RESOURCES-MIB::hrSWRunPerfCPU and returns SNMP_NOSUCHOBJECT.
Just bail rather than null-deref'ing.

Index: apps/snmpps.c
--- apps/snmpps.c.orig
+++ apps/snmpps.c
@@ -370,11 +370,13 @@ collect_perf(netsnmp_session *ss, struct hrSWRunTable 
         proc.hrSWRunStatus = *vlp2->val.integer;
 
         vlp2 = vlp2->next_variable;
-        if (vlp2->type == SNMP_NOSUCHINSTANCE) goto next;
+        if (vlp2->type == SNMP_NOSUCHINSTANCE ||
+                    vlp2->type == SNMP_NOSUCHOBJECT) goto next;
         proc.hrSWRunPerfCPU = *vlp2->val.integer;
 
         vlp2 = vlp2->next_variable;
-        if (vlp2->type == SNMP_NOSUCHINSTANCE) goto next;
+        if (vlp2->type == SNMP_NOSUCHINSTANCE ||
+                    vlp2->type == SNMP_NOSUCHOBJECT) goto next;
         proc.hrSWRunPerfMem = *vlp2->val.integer;
 
         count++;
