import librepo-1.14.2-4.el8

This commit is contained in:
CentOS Sources 2023-03-28 08:48:37 +00:00 committed by Stepan Oksanichenko
parent 0df3cf2251
commit 4c94713389
4 changed files with 143 additions and 1 deletions

View File

@ -0,0 +1,51 @@
From dc640e127f4c678c9dfbda776994972600d53e56 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Hr=C3=A1zk=C3=BD?= <lhrazky@redhat.com>
Date: Tue, 16 Aug 2022 13:44:22 +0200
Subject: [PATCH] Use g_strdup_vprintf() instead of manually calculating
allocation space
Fixes an error introduced in d2508e206514bdbf841ee72f4971336766c16fe1 by
removing trailing NULLs, on which the size calculation code was relying.
Instead of this incosistent argument iteration, use g_strdup_vprintf(),
which allocates the new string correctly.
---
librepo/metadata_downloader.c | 19 ++-----------------
1 file changed, 2 insertions(+), 17 deletions(-)
diff --git a/librepo/metadata_downloader.c b/librepo/metadata_downloader.c
index 9e7d7e5..92a462b 100644
--- a/librepo/metadata_downloader.c
+++ b/librepo/metadata_downloader.c
@@ -98,26 +98,11 @@ void
lr_metadatatarget_append_error(LrMetadataTarget *target, char *format, ...)
{
va_list valist;
- size_t length = strlen(format);
- char *error_message = NULL;
-
- va_start(valist, format);
- while (1) {
- char *arg = va_arg(valist, char*);
- if (arg == NULL)
- break;
-
- length += strlen(arg);
- }
- length += RESERVE;
- va_end(valist);
-
va_start(valist, format);
- error_message = malloc(length * sizeof(char));
- vsnprintf(error_message, length, format, valist);
+ gchar *error_message = g_strdup_vprintf(format, valist);
va_end(valist);
- target->err = g_list_append(target->err, (gpointer) error_message);
+ target->err = g_list_append(target->err, error_message);
}
static gboolean
--
2.37.1

View File

@ -0,0 +1,55 @@
From a5305e7f957666c92040fa0134d69d9fbeb5db70 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Hr=C3=A1zk=C3=BD?= <lhrazky@redhat.com>
Date: Tue, 16 Aug 2022 15:41:44 +0200
Subject: [PATCH] Use g_list_free_full() to free LRMetadataTarget::err
Fixes a memory leak where the char * items in the list were not freed.
---
CMakeLists.txt | 2 +-
librepo.spec | 2 +-
librepo/metadata_downloader.c | 3 +--
3 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index a45d5c4..b4007e3 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -28,7 +28,7 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")
# Find necessare libraries
FIND_PACKAGE(PkgConfig)
-PKG_CHECK_MODULES(GLIB2 glib-2.0 REQUIRED)
+PKG_CHECK_MODULES(GLIB2 glib-2.0>=2.28 REQUIRED)
PKG_SEARCH_MODULE(LIBCRYPTO REQUIRED libcrypto openssl)
PKG_CHECK_MODULES(LIBXML2 libxml-2.0 REQUIRED)
FIND_PACKAGE(CURL 7.52.0 REQUIRED)
diff --git a/librepo.spec b/librepo.spec
index 5a733b2..88d6d6d 100644
--- a/librepo.spec
+++ b/librepo.spec
@@ -23,7 +23,7 @@ BuildRequires: cmake
BuildRequires: gcc
BuildRequires: check-devel
BuildRequires: doxygen
-BuildRequires: pkgconfig(glib-2.0)
+BuildRequires: pkgconfig(glib-2.0) >= 2.28
BuildRequires: gpgme-devel
BuildRequires: libattr-devel
BuildRequires: libcurl-devel >= %{libcurl_version}
diff --git a/librepo/metadata_downloader.c b/librepo/metadata_downloader.c
index 92a462b..cda1e40 100644
--- a/librepo/metadata_downloader.c
+++ b/librepo/metadata_downloader.c
@@ -89,8 +89,7 @@ lr_metadatatarget_free(LrMetadataTarget *target)
if (!target)
return;
g_string_chunk_free(target->chunk);
- if (target->err != NULL)
- g_list_free(target->err);
+ g_list_free_full(target->err, g_free);
g_free(target);
}
--
2.37.1

View File

@ -0,0 +1,29 @@
From a69522533248093c11f11f964a3d42cb08bf7822 Mon Sep 17 00:00:00 2001
From: Jan Kolarik <jkolarik@redhat.com>
Date: Mon, 22 Aug 2022 08:18:04 +0200
Subject: [PATCH] Detailed error message when using non-existing TMPDIR
(RhBug:2019993)
= changelog =
type: bugfix
resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2019993
---
librepo/util.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/librepo/util.c b/librepo/util.c
index 204572d..f4aa512 100644
--- a/librepo/util.c
+++ b/librepo/util.c
@@ -158,7 +158,7 @@ lr_gettmpfile(void)
template = g_build_filename(g_get_tmp_dir(), "librepo-tmp-XXXXXX", NULL);
fd = mkstemp(template);
if (fd < 0) {
- perror("Cannot create temporary file - mkstemp");
+ fprintf(stderr, "Cannot create temporary file - mkstemp '%s': %s\n", template, strerror(errno));
exit(1);
}
unlink(template);
--
2.37.1

View File

@ -12,7 +12,7 @@
Name: librepo
Version: 1.14.2
Release: 3%{?dist}
Release: 4%{?dist}
Summary: Repodata downloading library
License: LGPLv2+
@ -22,6 +22,9 @@ Source0: %{url}/archive/%{version}/%{name}-%{version}.tar.gz
Patch0001: 0001-Use-nanosec-precision-for-timestamp-of-checksum-cach.patch
Patch0002: 0002-Fix-alloc-free-mismatches-from-covscan.patch
Patch0003: 0003-More-covscan-fixes.patch
Patch0004: 0004-Use-g_strdup_vprintf-instead-of-manually-calculating.patch
Patch0005: 0005-Use-g_list_free_full-to-free-LRMetadataTarget-err.patch
Patch0006: 0006-Detailed-error-message-when-using-non-existing-TMPDI.patch
BuildRequires: cmake
BuildRequires: gcc
@ -100,6 +103,10 @@ Python 3 bindings for the librepo library.
%{python3_sitearch}/%{name}/
%changelog
* Mon Sep 12 2022 Lukas Hrazky <lhrazky@redhat.com> - 1.14.2-4
- Fix termination of va_list in lr_metadatatarget_append_error()
- Detailed error message when using non-existing TMPDIR
* Mon Jul 25 2022 Lukas Hrazky <lhrazky@redhat.com> - 1.14.2-3
- Fix covscan issues