* [PATCH] libtracecmd: Free buf_from in error path of tracecmd_compress_copy_from()
@ 2023-06-02 7:58 Steven Rostedt
0 siblings, 0 replies; only message in thread
From: Steven Rostedt @ 2023-06-02 7:58 UTC (permalink / raw)
To: Linux Trace Devel; +Cc: Markus Elfring
From: "Steven Rostedt (Google)" <rostedt@goodmis.org>
The failure of allocating buf_to returns without freeing buf_from.
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=217127
Reported-by: Markus Elfring <Markus.Elfring@web.de>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
---
lib/trace-cmd/trace-compress.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/lib/trace-cmd/trace-compress.c b/lib/trace-cmd/trace-compress.c
index ca6e03b88e69..e550dbd4b0d5 100644
--- a/lib/trace-cmd/trace-compress.c
+++ b/lib/trace-cmd/trace-compress.c
@@ -696,8 +696,10 @@ int tracecmd_compress_copy_from(struct tracecmd_compression *handle, int fd, int
return -1;
buf_to = malloc(csize);
- if (!buf_to)
+ if (!buf_to) {
+ free(buf_from);
return -1;
+ }
/* save the initial offset and write 0 as initial chunk count */
offset = lseek(handle->fd, 0, SEEK_CUR);
--
2.39.2
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2023-06-02 7:58 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-02 7:58 [PATCH] libtracecmd: Free buf_from in error path of tracecmd_compress_copy_from() Steven Rostedt
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).