diff --git a/libdnf/dnf-sack.cpp b/libdnf/dnf-sack.cpp index 3022feff1..3c3a76578 100644 --- a/libdnf/dnf-sack.cpp +++ b/libdnf/dnf-sack.cpp @@ -239,7 +239,7 @@ try_to_use_cached_solvfile(const char *path, Repo *repo, int flags, const unsign } return FALSE; } - std::unique_ptr solv_userdata = solv_userdata_read(fp_cache); + std::unique_ptr solv_userdata = solv_userdata_read(fp_cache); gboolean ret = TRUE; if (solv_userdata && solv_userdata_verify(solv_userdata.get(), checksum)) { // after reading the header rewind to the begining diff --git a/libdnf/hy-iutil-private.hpp b/libdnf/hy-iutil-private.hpp index afa459914..ed98ea2c3 100644 --- a/libdnf/hy-iutil-private.hpp +++ b/libdnf/hy-iutil-private.hpp @@ -46,7 +46,7 @@ struct SolvUserdata { }__attribute__((packed)); ; int solv_userdata_fill(SolvUserdata *solv_userdata, const unsigned char *checksum, GError** error); -std::unique_ptr solv_userdata_read(FILE *fp); +std::unique_ptr solv_userdata_read(FILE *fp); int solv_userdata_verify(const SolvUserdata *solv_userdata, const unsigned char *checksum); /* crypto utils */ diff --git a/libdnf/hy-iutil.cpp b/libdnf/hy-iutil.cpp index c0c467c25..43314c60b 100644 --- a/libdnf/hy-iutil.cpp +++ b/libdnf/hy-iutil.cpp @@ -199,21 +199,21 @@ solv_userdata_fill(SolvUserdata *solv_userdata, const unsigned char *checksum, G } -std::unique_ptr +std::unique_ptr solv_userdata_read(FILE *fp) { unsigned char *dnf_solvfile_userdata_read = NULL; int dnf_solvfile_userdata_len_read; if (!fp) { - return {NULL, free}; + return {NULL, solv_free}; } int ret_code = solv_read_userdata(fp, &dnf_solvfile_userdata_read, &dnf_solvfile_userdata_len_read); // The userdata layout has to match our struct exactly so we can just cast the memory // allocated by libsolv - std::unique_ptr uniq_userdata( + std::unique_ptr uniq_userdata( reinterpret_cast(dnf_solvfile_userdata_read), - free); + solv_free); if(ret_code) { g_warning("Failed to read solv userdata: solv_read_userdata returned: %i", ret_code); return uniq_userdata; diff --git a/tests/hawkey/test_iutil.cpp b/tests/hawkey/test_iutil.cpp index 050463c57..6e549b9d6 100644 --- a/tests/hawkey/test_iutil.cpp +++ b/tests/hawkey/test_iutil.cpp @@ -123,7 +123,7 @@ START_TEST(test_dnf_solvfile_userdata) fclose(fp); fp = fopen(new_file, "r"); - std::unique_ptr dnf_solvfile = solv_userdata_read(fp); + std::unique_ptr dnf_solvfile = solv_userdata_read(fp); fail_unless(dnf_solvfile); fail_unless(solv_userdata_verify(dnf_solvfile.get(), cs_computed)); fclose(fp);