kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Markus Elfring <Markus.Elfring@web.de>
To: Masami Hiramatsu <mhiramat@kernel.org>,
	lumingyindetect@126.com, linux-trace-kernel@vger.kernel.org,
	kernel-janitors@vger.kernel.org
Cc: LKML <linux-kernel@vger.kernel.org>,
	Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
	Steven Rostedt <rostedt@goodmis.org>
Subject: Re: tracing/probes: Fix a memory leak in traceprobe_parse_probe_arg_body()
Date: Fri, 26 Apr 2024 18:45:21 +0200	[thread overview]
Message-ID: <77a68fbd-5675-45e7-b563-883e5c0643cb@web.de> (raw)
In-Reply-To: <20240427001843.84a3d367d3654b624c09defe@kernel.org>

…
> ----
>  If traceprobe_parse_probe_arg_body() fails to allocate 'parg->fmt', it
>  jumps to 'out' instead of 'fail' by mistake. In the result, in this
>  case the 'tmp' buffer is not freed and leaks its memory.
>
>  Fix it by jumping to 'fail' in that case.
> ----
…

How do you think about another approach for a more desirable change description?

   If traceprobe_parse_probe_arg_body() failed to allocate the object “parg->fmt”,
   it jumps to the label “out” instead of “fail” by mistake.
   In the result, the buffer “tmp” is not freed in this case and leaks its memory.

   Thus jump to the label “fail” in that case (so that the exception handling
   will be improved another bit).


Regards,
Markus

           reply	other threads:[~2024-04-26 16:45 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <20240427001843.84a3d367d3654b624c09defe@kernel.org>]

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=77a68fbd-5675-45e7-b563-883e5c0643cb@web.de \
    --to=markus.elfring@web.de \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=lumingyindetect@126.com \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=mhiramat@kernel.org \
    --cc=rostedt@goodmis.org \
    /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;
as well as URLs for NNTP newsgroup(s).