]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
libkvm: Plug couple of memory leaks and check possible calloc(3) failure
authorJung-uk Kim <jkim@FreeBSD.org>
Wed, 3 Mar 2021 23:10:00 +0000 (18:10 -0500)
committerJung-uk Kim <jkim@FreeBSD.org>
Sat, 6 Mar 2021 19:32:51 +0000 (14:32 -0500)
commiteda8f0575dda15346116d3be84b205c51c83e20b
tree3029a13998b3debbee0e3e7f64fa4aa83bbbc151
parent99e1b2d79868eb8bad371b6d4d64fa1aab99fbc4
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)
lib/libkvm/kvm.c