Re: [PATCH v2] fs/exfat: resolve memory leak from exfat_create_upcase_table()
From: Al Viro
Date: Mon Sep 16 2024 - 18:12:25 EST
On Mon, Sep 16, 2024 at 02:58:43PM -0700, Daniel Yang wrote:
> In exfat_create_upcase_table, ENOMEM and EINVAL result in a jump to
> exfat_load_default_upcase_table where memory is also allocated. Since
> ENOMEM doesn't allocate memory, freeing null addresses will result in a
> double free.
Freeing null address is a no-op. Explicitly guaranteed, for the
same reason why C standard guarantees that free(NULL) is a no-op.
So you don't need to check if allocation had been done.