[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <2996113.1648654634@warthog.procyon.org.uk>
Date: Wed, 30 Mar 2022 16:37:14 +0100
From: David Howells <dhowells@...hat.com>
To: Denis Glazkov <d.glazkov@....ru>
Cc: dhowells@...hat.com, "jarkko@...nel.org" <jarkko@...nel.org>,
"jmorris@...ei.org" <jmorris@...ei.org>,
"keyrings@...r.kernel.org" <keyrings@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linux-security-module@...r.kernel.org"
<linux-security-module@...r.kernel.org>,
"mkayaalp@...ux.vnet.ibm.com" <mkayaalp@...ux.vnet.ibm.com>,
"serge@...lyn.com" <serge@...lyn.com>,
"zohar@...ux.vnet.ibm.com" <zohar@...ux.vnet.ibm.com>
Subject: Re: [PATCH v2] KEYS: fix memory leaks when reading certificate
Denis Glazkov <d.glazkov@....ru> wrote:
> The `exit()` function usage produce possible memory leaks. This
> patch removes the use of the `exit()` function and adds memory
> free in case of a negative scenarios.
?
Barring a kernel bug, there should be no memory leaks from exit(). _exit() is
the ultimate process cleanup tool. Calling free() won't necessarily return
the memory allocated by malloc() to the kernel.
Unless you have a good reason to actually tear down everything, just print a
message and call exit on error in little helpers like this.
David
Powered by blists - more mailing lists