summaryrefslogtreecommitdiff
path: root/backport-Fix-an-ancient-memleak-on-caps-parsing-add-tests.patch
diff options
context:
space:
mode:
authorCoprDistGit <infra@openeuler.org>2024-09-18 07:05:42 +0000
committerCoprDistGit <infra@openeuler.org>2024-09-18 07:05:42 +0000
commit4ad1d692311b38472d44f5deb9c32634b334ed4d (patch)
tree3e004676c8e07b495fdeda7291033d0fde73d783 /backport-Fix-an-ancient-memleak-on-caps-parsing-add-tests.patch
parente248808867f90830a43b5ca5d192bef9dd2edec2 (diff)
automatic import of rpm
Diffstat (limited to 'backport-Fix-an-ancient-memleak-on-caps-parsing-add-tests.patch')
-rw-r--r--backport-Fix-an-ancient-memleak-on-caps-parsing-add-tests.patch34
1 files changed, 34 insertions, 0 deletions
diff --git a/backport-Fix-an-ancient-memleak-on-caps-parsing-add-tests.patch b/backport-Fix-an-ancient-memleak-on-caps-parsing-add-tests.patch
new file mode 100644
index 0000000..bc0dd4d
--- /dev/null
+++ b/backport-Fix-an-ancient-memleak-on-caps-parsing-add-tests.patch
@@ -0,0 +1,34 @@
+From a385821780804b558ae18aec820d127e4144fafd Mon Sep 17 00:00:00 2001
+From: Panu Matilainen <pmatilai@redhat.com>
+Date: Thu, 11 Apr 2024 12:08:04 +0300
+Subject: [PATCH] Fix an ancient memleak on %caps() parsing, add tests
+
+Conflict:don't modify tests because the test case depends on the gcc.
+Reference:https://github.com/rpm-software-management/rpm/commit/a385821780804b558ae18aec820d127e4144fafd
+
+This leak has been there ever since rpm 4.7.0, so pretty close to 15
+years. ASAN would've caught it, if it had it been tested. Oops.
+Of course, in the fakechroot era we couldn't have tested installation
+but we could've at least tested the parsing side.
+
+Add tests for parsing, query and install functionality, and fix the
+leak that is now very visible.
+---
+ build/files.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/build/files.c b/build/files.c
+index 14e4c55ef..b059458a1 100644
+--- a/build/files.c
++++ b/build/files.c
+@@ -228,6 +228,7 @@ static void copyFileEntry(FileEntry src, FileEntry dest)
+ static void FileEntryFree(FileEntry entry)
+ {
+ argvFree(entry->langs);
++ free(entry->caps);
+ memset(entry, 0, sizeof(*entry));
+ }
+
+--
+2.33.0
+