Re: git: a37e0e6de652 - main - pf: fix more syncookie memory leaks

From: Konstantin Belousov <kostikbel_at_gmail.com>
Date: Fri, 03 Jun 2022 23:49:03 UTC
On Thu, Jun 02, 2022 at 06:18:10PM +0000, Kristof Provost wrote:
> The branch main has been updated by kp:
> 
> URL: https://cgit.FreeBSD.org/src/commit/?id=a37e0e6de6527a7eaddea8e28f5e4b3427fba1a4
> 
> commit a37e0e6de6527a7eaddea8e28f5e4b3427fba1a4
> Author:     Franco Fichtner <franco@opnsense.org>
> AuthorDate: 2022-06-02 16:27:43 +0000
> Commit:     Kristof Provost <kp@FreeBSD.org>
> CommitDate: 2022-06-02 18:17:25 +0000
> 
>     pf: fix more syncookie memory leaks
>     
>     Allocate memory for packed nvlists in M_NVLIST, as nvlist_pack() does
>     this as well, and we use the same variable interchangable with the
>     memory we allocate. When we free it we can end up freeing from the wrong
>     zone, leaking memory.

Only a nit-pick, and only in the commit message.  I do not think that this
causes a memory leak, only mis-accounting.  Zone for the memory to be freed
is calculated based on the memory address, not memory type argument, so the
correct zone is used (if not, it would corrupt uma structures).

The effect should be that one type keeps growing the count, while another
becomes under-calculated, e.g. negative.