mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: David Howells <dhowells@redhat.com>
To: Denis Glazkov <d.glazkov@omp.ru>
Cc: dhowells@redhat.com, "jarkko@kernel.org" <jarkko@kernel.org>,
	"jmorris@namei.org" <jmorris@namei.org>,
	"keyrings@vger.kernel.org" <keyrings@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-security-module@vger.kernel.org" 
	<linux-security-module@vger.kernel.org>,
	"mkayaalp@linux.vnet.ibm.com" <mkayaalp@linux.vnet.ibm.com>,
	"serge@hallyn.com" <serge@hallyn.com>,
	"zohar@linux.vnet.ibm.com" <zohar@linux.vnet.ibm.com>
Subject: Re: [PATCH v2] KEYS: fix memory leaks when reading certificate
Date: Wed, 30 Mar 2022 16:37:14 +0100	[thread overview]
Message-ID: <2996113.1648654634@warthog.procyon.org.uk> (raw)
In-Reply-To: <20220303125627.93930-1-d.glazkov@omp.ru>

Denis Glazkov <d.glazkov@omp.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


      parent reply	other threads:[~2022-03-30 15:37 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-03  8:15 [PATCH] KEYS: fix memory leak when reading certificate fails Denis Glazkov
2022-03-03 12:02 ` Dongliang Mu
2022-03-03 12:56 ` [PATCH v2] KEYS: fix memory leaks when reading certificate Denis Glazkov
2022-03-30 15:37 ` David Howells [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2996113.1648654634@warthog.procyon.org.uk \
    --to=dhowells@redhat.com \
    --cc=d.glazkov@omp.ru \
    --cc=jarkko@kernel.org \
    --cc=jmorris@namei.org \
    --cc=keyrings@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=mkayaalp@linux.vnet.ibm.com \
    --cc=serge@hallyn.com \
    --cc=zohar@linux.vnet.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®