Skip to content

Commit

Permalink
Use g_list_free_full() to free LRMetadataTarget::err
Browse files Browse the repository at this point in the history
Fixes a memory leak where the char * items in the list were not freed.
  • Loading branch information
Lukáš Hrázký authored and jrohel committed Aug 17, 2022
1 parent 12ac813 commit 7b1559f
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion librepo.spec
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
3 changes: 1 addition & 2 deletions librepo/metadata_downloader.c
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,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);
}

Expand Down

0 comments on commit 7b1559f

Please sign in to comment.