代码拉取完成,页面将自动刷新
同步操作将从 src-openEuler/gala-gopher 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
From 01f2d382131f26ca81b0997532d0b73515ca33c7 Mon Sep 17 00:00:00 2001
From: wo_cow <niuqianqian@huawei.com>
Date: Wed, 14 Dec 2022 16:32:13 +0800
Subject: [PATCH] fix stackprobe memory allocation and deallocation errors.
---
.../extends/ebpf.probe/src/stackprobe/stackprobe.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/src/probes/extends/ebpf.probe/src/stackprobe/stackprobe.c b/src/probes/extends/ebpf.probe/src/stackprobe/stackprobe.c
index da09094..fa37a72 100644
--- a/src/probes/extends/ebpf.probe/src/stackprobe/stackprobe.c
+++ b/src/probes/extends/ebpf.probe/src/stackprobe/stackprobe.c
@@ -105,7 +105,7 @@ typedef struct {
struct bpf_link_hash_value {
enum pid_state_t pid_state;
char elf_path[MAX_PATH_LEN];
- struct bpf_link *bpf_links[32];
+ struct bpf_link *bpf_links[32]; // 32 cover num of probes in memleak.bpf.c
};
struct bpf_link_hash_t {
@@ -314,7 +314,7 @@ static struct raw_stack_trace_s *create_raw_stack_trace(struct stack_trace_s *st
size_t stack_size = st->cpus_num * PERCPU_SAMPLE_COUNT;
size_t mem_size = sizeof(struct raw_stack_trace_s);
- mem_size += (stack_size * sizeof(struct stack_id_s));
+ mem_size += (stack_size * sizeof(struct raw_trace_s));
raw_stack_trace = (struct raw_stack_trace_s *)malloc(mem_size);
if (!raw_stack_trace) {
@@ -747,7 +747,6 @@ static void destroy_svg_stack_trace(struct svg_stack_trace_s **ptr_svg_st)
static void destroy_stack_trace(struct stack_trace_s **ptr_st)
{
- // TODO:destroy_svg_stack_trace?
struct stack_trace_s *st = *ptr_st;
*ptr_st = NULL;
if (!st) {
@@ -761,6 +760,13 @@ static void destroy_stack_trace(struct stack_trace_s **ptr_st)
}
}
+ for (int i = 0; i < STACK_SVG_MAX; i++) {
+ if (st->svg_stack_traces[i] == NULL) {
+ continue;
+ }
+ destroy_svg_stack_trace(&st->svg_stack_traces[i]);
+ }
+
if (st->ksymbs) {
destroy_ksymbs_tbl(st->ksymbs);
(void)free(st->ksymbs);
--
2.33.0
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。