]> www.infradead.org Git - users/mchehab/rasdaemon.git/commitdiff
rasdaemon: fix memory leak in parse_ras_data
authorJosh Hunt <johunt@akamai.com>
Fri, 8 Jan 2021 00:12:52 +0000 (19:12 -0500)
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Wed, 3 Feb 2021 09:52:32 +0000 (10:52 +0100)
parse_ras_data() is calling trace_seq_init() which allocates a buffer,
but never calls the corresponding trace_seq_destroy() to free it causing
us to leak memory.

Reported-by: Subhendu Saha <subhends@akamai.com>
Signed-off-by: Josh Hunt <johunt@akamai.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
ras-events.c

index c797b2079a6ece99f060f2bcdb2843c7deda52a6..4509f569289b807f5bce1992c7d4dd3172b1df3a 100644 (file)
@@ -317,6 +317,7 @@ static void parse_ras_data(struct pthread_data *pdata, struct kbuffer *kbuf,
        trace_seq_do_printf(&s);
        printf("\n");
        fflush(stdout);
+       trace_seq_destroy(&s);
 }
 
 static int get_num_cpus(struct ras_events *ras)