diff --git a/0001-Fix-memleak-in-tuple-creation.patch b/0001-Fix-memleak-in-tuple-creation.patch new file mode 100644 index 0000000000000000000000000000000000000000..157e2c4e2c27fc5ac8d3e0ebd356ad1de2499995 --- /dev/null +++ b/0001-Fix-memleak-in-tuple-creation.patch @@ -0,0 +1,41 @@ +From 7f664adea64191d756ed715a09bfbac48db04718 Mon Sep 17 00:00:00 2001 +From: Jordan Rome +Date: Fri, 23 Aug 2024 19:59:32 +0800 +Subject: [PATCH] Fix memleak in tuple creation + +The new ExpressionList created by vargs needs to get +deleted after we move it's elements into the Tuple's +ExpressionList. +--- + src/parser.yy | 2 ++ + tests/memleak-tests.sh | 1 + + 2 files changed, 3 insertions(+) + +diff --git a/src/parser.yy b/src/parser.yy +index d11dd96..9234662 100644 +--- a/src/parser.yy ++++ b/src/parser.yy +@@ -422,6 +422,8 @@ primary_expr: + auto args = new ast::ExpressionList; + args->emplace_back($2); + args->insert(args->end(), $4->begin(), $4->end()); ++ delete $4; ++ $4 = nullptr; + $$ = new ast::Tuple(args, @$); + } + ; +diff --git a/tests/memleak-tests.sh b/tests/memleak-tests.sh +index 7346ce9..cec48e0 100755 +--- a/tests/memleak-tests.sh ++++ b/tests/memleak-tests.sh +@@ -30,6 +30,7 @@ fi + tests=( + '"BEGIN { exit(); }"' + $'"#include \n BEGIN { \$x = ((struct sk_buff *)curtask)->data_len; exit(); }"' ++ '"BEGIN { print((1, 2)); exit(); }"' + ) + + echo "${GREEN}[==========]${NC} Running ${#tests[@]} tests" +-- +2.43.0 + diff --git a/bpftrace.spec b/bpftrace.spec index 959d15037012e01262cad6330a104c404493e055..95c46949d51f495ab639de5346259dda1adc59aa 100644 --- a/bpftrace.spec +++ b/bpftrace.spec @@ -1,12 +1,12 @@ Name: bpftrace Version: 0.19.1 -Release: 2 +Release: 3 Summary: High-level tracing language for Linux eBPF License: ASL 2.0 URL: https://github.com/iovisor/bpftrace Source0: %{url}/archive/refs/tags/v%{version}.tar.gz - +Patch0001: 0001-Fix-memleak-in-tuple-creation.patch # Arches will be included as upstream support is added and dependencies are # satisfied in the respective arches ExclusiveArch: x86_64 %{power64} aarch64 riscv64 loongarch64 @@ -68,6 +68,9 @@ find %{buildroot}%{_datadir}/%{name}/tools -type f -exec \ %changelog +* Wed Aug 28 2024 changtao - 0.19.1-3 +- 0001-Fix-memleak-in-tuple-creation.patch + * Tue Feb 27 2024 Huang Yang - 0.19.1-2 - add loongarch64 support