On Wed, 30 May 2018 16:25:55 +0800 Nan Xiao <n...@chinadtrace.org> wrote:
> Hi tech@,
> 
> Maybe kvm_close is needed if kvm_getprocs returns NULL here? Sorry if I
> am wrong, thanks!
> 
> Index: mib.c
> ===================================================================
> RCS file: /cvs/src/usr.sbin/snmpd/mib.c,v
> retrieving revision 1.87
> diff -u -p -r1.87 mib.c
> --- mib.c     25 May 2018 08:23:15 -0000      1.87
> +++ mib.c     30 May 2018 08:15:19 -0000
> @@ -516,8 +516,10 @@ mib_hrsystemprocs(struct oid *oid, struc
>                       return (-1);
> 
>               if (kvm_getprocs(kd, KERN_PROC_ALL, 0,
> -                 sizeof(struct kinfo_proc), &val) == NULL)
> +                 sizeof(struct kinfo_proc), &val) == NULL) {
> +                     kvm_close(kd);
>                       return (-1);
> +             }
> 
>               *elm = ber_add_integer(*elm, val);
>               ber_set_header(*elm, BER_CLASS_APPLICATION, SNMP_T_GAUGE32);
> 


Looks reasonable.

Reply via email to