]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
pf: fix ioctl() memory leak
authorKristof Provost <kp@FreeBSD.org>
Mon, 24 May 2021 06:32:16 +0000 (08:32 +0200)
committerKristof Provost <kp@FreeBSD.org>
Thu, 27 May 2021 07:12:03 +0000 (09:12 +0200)
commitff4447ac31ca1ee54ac7e2a01ba11c3bc8cafdca
treeda3e9300a49f4ab092b79a5a0456a1e3352294e5
parent2f0a80794895a67c8b5882144c8b1e41c4fa8688
pf: fix ioctl() memory leak

When we create an nvlist and insert it into another nvlist we must
remember to destroy it. The nvlist_add_nvlist() function makes a copy,
just like nvlist_add_string() makes a copy of the string. If we don't
we're leaking memory on every (nvlist-based) ioctl() call.

While here remove two redundant 'break' statements.

PR: 255971
MFC after: 3 days
Sponsored by: Rubicon Communications, LLC ("Netgate")

(cherry picked from commit 4483fb47735c29408c72045469c9c4b3e549668b)
sys/netpfil/pf/pf_ioctl.c