Re: [PATCH v2] tty: vt: fix memory leak in vc_allocate()

Mingyu Wang <[email protected]> Mon, 3 Aug 2026 22:39:29 +0800
Newsgroups org.kernel.vger.linux-serial,org.kernel.vger.linux-kernel,org.kernel.vger.stable
Message-ID <[email protected]>
Hi Greg,

> Shouldn't you be checking vc->uni_pagedict_loc before calling this
> function?
>
> Right now we have callers sometimes checking this, and sometimes not,
> while the function doesn't seem to care, but we should be consistant,
> right?  This will only need to be cleaned up if the previous check in
> this function was correct.

Thank you for the review.

Yes, the previous check in this function is correct. It acts as a
conditional initialization, allocating the default map only if the VC
did not already inherit one during visual_init().

While con_free_unimap() safely handles NULL internally, I completely
agree that keeping the callers consistent is better for readability
and maintenance.

I will add the explicit check for *vc->uni_pagedict_loc in the
err_free path and send a v3 shortly.

Best regards,
Mingyu Wang