Sync upstream patches

This commit is contained in:
zjay998 2022-10-11 18:54:18 +08:00
parent 4e64cdf807
commit 31e4ae2574
3 changed files with 70 additions and 1 deletions

View File

@ -0,0 +1,29 @@
From 9a361f5248557e032f15890aac54c0db53c52098 Mon Sep 17 00:00:00 2001
From: banjiuqingshan <63209634+banjiuqingshan@users.noreply.github.com>
Date: Sun, 19 Jun 2022 01:43:51 +0800
Subject: [PATCH] Fix memory leak when using testsolv to execute cases
*resultp will only keep the pointer of the last cycle, which will lead to memory leakage.
This solves the first memory leak problem in issue #496 "==255147==error..."
---
ext/testcase.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/ext/testcase.c b/ext/testcase.c
index 035cfdbd..c529057a 100644
--- a/ext/testcase.c
+++ b/ext/testcase.c
@@ -2448,7 +2448,10 @@ testcase_read(Pool *pool, FILE *fp, const char *testcase, Queue *job, char **res
}
}
if (resultp)
+ {
+ solv_free(*resultp);
*resultp = result;
+ }
else
solv_free(result);
if (resultflagsp)
--
2.27.0

View File

@ -0,0 +1,30 @@
From 2b5e6c28be7dffe1a3b5e90a35c5ee425c08aeb0 Mon Sep 17 00:00:00 2001
From: niner <nine@detonation.org>
Date: Tue, 8 Feb 2022 18:10:54 +0100
Subject: [PATCH] Fix segfault on conflict resolution when using bindings
Solutionelement objects were created with a wrong solutionid (i.e. the
solution element id was used for the solutionid field). This led to invalid
array indexes when trying to read the extraflags which then escalated
into a segfault. Fix by setting solutionid correctly in the Solutionelement
constructor.
---
bindings/solv.i | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/bindings/solv.i b/bindings/solv.i
index 3a6bac46..1d35bf61 100644
--- a/bindings/solv.i
+++ b/bindings/solv.i
@@ -3411,7 +3411,7 @@ returnself(matchsolvable)
e = solv_calloc(1, sizeof(*e));
e->solv = solv;
e->problemid = problemid;
- e->solutionid = id;
+ e->solutionid = solutionid;
e->id = id;
e->type = type;
e->p = p;
--
2.27.0

View File

@ -15,12 +15,15 @@
Name: libsolv
Version: 0.7.20
Release: 1
Release: 2
Summary: Package dependency solver
License: BSD
URL: https://github.com/openSUSE/libsolv
Source: https://github.com/openSUSE/libsolv/archive/refs/tags/%{version}.tar.gz
Patch0: Fix-segfault-on-conflict-resolution-when-using-bindi.patch
Patch1: Fix-memory-leak-when-using-testsolv-to-execute-cases.patch
BuildRequires: cmake gcc-c++ ninja-build pkgconfig(rpm) zlib-devel
BuildRequires: libxml2-devel xz-devel bzip2-devel
%if %{with zstd}
@ -213,6 +216,13 @@ Python 3 version.
%{_mandir}/man3/%{name}*.3*
%changelog
* Tue Oct 11 2022 zhangjun<zhangjun@kylinos.cn> - 0.7.20-2
- Type:bugfix
- ID:NA
- SUG:NA
- DESC:Fix memory leak when using testsolv to execute cases
Fix segfault on conflict resolution when using bindings
* Sat Dec 25 2021 wangkerong<wangkerong@huawei.com> - 0.7.20-1
- update to 0.7.20