* [PATCH] trace-cmd: free kbuf on malloc err in tracecmd_read_page_record()
@ 2020-01-15 20:05 Marcelo Diop-Gonzalez
2020-01-21 2:18 ` Steven Rostedt
0 siblings, 1 reply; 2+ messages in thread
From: Marcelo Diop-Gonzalez @ 2020-01-15 20:05 UTC (permalink / raw)
To: rostedt; +Cc: linux-trace-devel
This fixes an unlikely but possible leak
Signed-off-by: Marcelo Diop-Gonzalez <marcgonzalez@google.com>
---
lib/trace-cmd/trace-input.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/trace-cmd/trace-input.c b/lib/trace-cmd/trace-input.c
index ac30a60..68da3a7 100644
--- a/lib/trace-cmd/trace-input.c
+++ b/lib/trace-cmd/trace-input.c
@@ -1746,7 +1746,7 @@ tracecmd_read_page_record(struct tep_handle *pevent, void *page, int size,
record = malloc(sizeof(*record));
if (!record)
- return NULL;
+ goto out_free;
memset(record, 0, sizeof(*record));
record->ts = ts;
--
2.25.0.rc1.283.g88dfdc4193-goog
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] trace-cmd: free kbuf on malloc err in tracecmd_read_page_record()
2020-01-15 20:05 [PATCH] trace-cmd: free kbuf on malloc err in tracecmd_read_page_record() Marcelo Diop-Gonzalez
@ 2020-01-21 2:18 ` Steven Rostedt
0 siblings, 0 replies; 2+ messages in thread
From: Steven Rostedt @ 2020-01-21 2:18 UTC (permalink / raw)
To: Marcelo Diop-Gonzalez; +Cc: linux-trace-devel
On Wed, 15 Jan 2020 15:05:15 -0500
Marcelo Diop-Gonzalez <marcgonzalez@google.com> wrote:
> This fixes an unlikely but possible leak
Applied, thanks Marcelo!
-- Steve
>
> Signed-off-by: Marcelo Diop-Gonzalez <marcgonzalez@google.com>
> ---
> lib/trace-cmd/trace-input.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/lib/trace-cmd/trace-input.c b/lib/trace-cmd/trace-input.c
> index ac30a60..68da3a7 100644
> --- a/lib/trace-cmd/trace-input.c
> +++ b/lib/trace-cmd/trace-input.c
> @@ -1746,7 +1746,7 @@ tracecmd_read_page_record(struct tep_handle *pevent, void *page, int size,
>
> record = malloc(sizeof(*record));
> if (!record)
> - return NULL;
> + goto out_free;
> memset(record, 0, sizeof(*record));
>
> record->ts = ts;
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-01-21 2:18 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-15 20:05 [PATCH] trace-cmd: free kbuf on malloc err in tracecmd_read_page_record() Marcelo Diop-Gonzalez
2020-01-21 2:18 ` Steven Rostedt
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.