dcavalca / rpms / libdnf

Forked from rpms/libdnf 2 years ago
Clone

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

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