HomeFreeBSD

libkvm: Plug couple of memory leaks and check possible calloc(3) failure

Description

libkvm: Plug couple of memory leaks and check possible calloc(3) failure

First, r204494 introduced dpcpu_off in struct __kvm and it was allocated
from _kvm_dpcpu_init() but it was not free(3)'ed from kvm_close(3).
Second, r291406 introduced kvm_nlist2(3) and converted kvm_nlist(3) to
use the new function but it did not free the temporary buffer.
Also, check possible calloc(3) failure while I am in the neighborhood.

Differential Revision: https://reviews.freebsd.org/D29019

(cherry picked from commit 645eaa2ccaed6eea801d07d6a092974fc1713896)
(cherry picked from commit 483c6da3a20b2064cd655f7cb19e6b98dee677ff)

Details

Provenance
jkimAuthored on Mar 3 2021, 11:10 PM
Differential Revision
D29019: kvm_nlist(3) leaks allocated memory
Parents
rG0824ed18916c: arcmsr(4): Fixed no action of hot plugging device on type_F adapter.
Branches
Unknown
Tags
Unknown