On Mon, Jun 04 2018, Gerhard Roth <[email protected]> wrote:
> On Thu, 31 May 2018 17:40:36 +0800 Nan Xiao <[email protected]> wrote:
>> Hi Gerhard,
>> 
>> Thanks for your reply!
>> 
>> Yes, if no "kvm_close(kd);", there will be resource (memory, file
>> descriptor) leak. So hope you can commit it, thanks!
>> 
>> 
>> On 5/30/2018 4:49 PM, Gerhard Roth wrote:
>> > On Wed, 30 May 2018 16:25:55 +0800 Nan Xiao <[email protected]> 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.
>> >   
>> 
>
>
> Reluctant to commit code with my own ok. Anybody else willing to
> give an ok?

ok jca@

-- 
jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF  DDCC 0DFA 74AE 1524 E7EE

Reply via email to