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

29 lines
1.4 KiB
Diff
Raw Permalink Normal View History

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