Blame SOURCES/0020-Fix-dnf_context_module_install-memory-leaks.patch

aea1e4
From 4a8a3f410552c58dfafb384bb361c6e40bebff1d Mon Sep 17 00:00:00 2001
aea1e4
From: Jaroslav Rohel <jrohel@redhat.com>
aea1e4
Date: Wed, 21 Jul 2021 11:01:32 +0200
aea1e4
Subject: [PATCH] Fix: dnf_context_module_install: memory leaks
aea1e4
aea1e4
---
aea1e4
 libdnf/dnf-context.cpp | 5 ++++-
aea1e4
 1 file changed, 4 insertions(+), 1 deletion(-)
aea1e4
aea1e4
diff --git a/libdnf/dnf-context.cpp b/libdnf/dnf-context.cpp
aea1e4
index 55af2b2..6cb0011 100644
aea1e4
--- a/libdnf/dnf-context.cpp
aea1e4
+++ b/libdnf/dnf-context.cpp
aea1e4
@@ -3486,7 +3486,10 @@ dnf_context_module_install(DnfContext * context, const char ** module_specs, GEr
aea1e4
                         }
aea1e4
                         for (const auto &nevra : modpkg->getArtifacts()) {
aea1e4
                             int epoch;
aea1e4
-                            char *name, *version, *release, *arch;
aea1e4
+                            g_autofree char *name = nullptr;
aea1e4
+                            g_autofree char *version = nullptr;
aea1e4
+                            g_autofree char *release = nullptr;
aea1e4
+                            g_autofree char *arch = nullptr;
aea1e4
                             if (hy_split_nevra(nevra.c_str(), &name, &epoch, &version, &release, &arch)) {
aea1e4
                                 // this really should never happen; unless the modular repodata is corrupted
aea1e4
                                 g_autofree char *errmsg = g_strdup_printf (_("Failed to parse module artifact NEVRA '%s'"), nevra.c_str());
aea1e4
--
aea1e4
libgit2 1.0.1
aea1e4