lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210702040955.631618-1-gushengxian507419@gmail.com>
Date:   Thu,  1 Jul 2021 21:09:55 -0700
From:   gushengxian <gushengxian507419@...il.com>
To:     will@...nel.org, mathieu.poirier@...aro.org, leo.yan@...aro.org,
        peterz@...radead.org, mingo@...hat.com, acme@...nel.org,
        mark.rutland@....com, alexander.shishkin@...ux.intel.com,
        jolsa@...hat.com, namhyung@...nel.org,
        linux-arm-kernel@...ts.infradead.org
Cc:     linux-perf-users@...r.kernel.org, linux-kernel@...r.kernel.org,
        gushengxian <gushengxian@...ong.com>
Subject: [PATCH] perf: tests: fix some mmemory leak issues

From: gushengxian <gushengxian@...ong.com>

Some memory leak issues should be fixed by free().
Reported by cppcheck.

Signed-off-by: gushengxian <gushengxian@...ong.com>
---
 tools/perf/arch/arm/tests/dwarf-unwind.c     | 1 +
 tools/perf/arch/arm64/tests/dwarf-unwind.c   | 1 +
 tools/perf/arch/powerpc/tests/dwarf-unwind.c | 1 +
 tools/perf/arch/x86/tests/dwarf-unwind.c     | 1 +
 4 files changed, 4 insertions(+)

diff --git a/tools/perf/arch/arm/tests/dwarf-unwind.c b/tools/perf/arch/arm/tests/dwarf-unwind.c
index ccfa87055c4a..f2541d1dbb02 100644
--- a/tools/perf/arch/arm/tests/dwarf-unwind.c
+++ b/tools/perf/arch/arm/tests/dwarf-unwind.c
@@ -39,6 +39,7 @@ static int sample_ustack(struct perf_sample *sample,
 	memcpy(buf, (void *) sp, stack_size);
 	stack->data = (char *) buf;
 	stack->size = stack_size;
+	free(buf);
 	return 0;
 }
 
diff --git a/tools/perf/arch/arm64/tests/dwarf-unwind.c b/tools/perf/arch/arm64/tests/dwarf-unwind.c
index 46147a483049..ecd25c77a71f 100644
--- a/tools/perf/arch/arm64/tests/dwarf-unwind.c
+++ b/tools/perf/arch/arm64/tests/dwarf-unwind.c
@@ -39,6 +39,7 @@ static int sample_ustack(struct perf_sample *sample,
 	memcpy(buf, (void *) sp, stack_size);
 	stack->data = (char *) buf;
 	stack->size = stack_size;
+	free(buf);
 	return 0;
 }
 
diff --git a/tools/perf/arch/powerpc/tests/dwarf-unwind.c b/tools/perf/arch/powerpc/tests/dwarf-unwind.c
index 8efd9ed9e9db..e57a8ca52ce7 100644
--- a/tools/perf/arch/powerpc/tests/dwarf-unwind.c
+++ b/tools/perf/arch/powerpc/tests/dwarf-unwind.c
@@ -40,6 +40,7 @@ static int sample_ustack(struct perf_sample *sample,
 	memcpy(buf, (void *) sp, stack_size);
 	stack->data = (char *) buf;
 	stack->size = stack_size;
+	free(buf);
 	return 0;
 }
 
diff --git a/tools/perf/arch/x86/tests/dwarf-unwind.c b/tools/perf/arch/x86/tests/dwarf-unwind.c
index 478078fb0f22..da90b33a1e28 100644
--- a/tools/perf/arch/x86/tests/dwarf-unwind.c
+++ b/tools/perf/arch/x86/tests/dwarf-unwind.c
@@ -47,6 +47,7 @@ static int sample_ustack(struct perf_sample *sample,
 #endif
 	stack->data = (char *) buf;
 	stack->size = stack_size;
+	free(buf);
 	return 0;
 }
 
-- 
2.25.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ