chantra / rpms / libdnf

Forked from rpms/libdnf 2 years ago
Clone
Blob Blame History Raw
From 831d023c3c6fb4a28903cb3170efdd9f85645e1a Mon Sep 17 00:00:00 2001
From: Jaroslav Mracek <jmracek@redhat.com>
Date: Fri, 20 Nov 2020 16:30:17 +0100
Subject: [PATCH] Fix removal step during modular enable in context part

It resolves `free(): double free detected in tcache 2`
---
 libdnf/dnf-context.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libdnf/dnf-context.cpp b/libdnf/dnf-context.cpp
index 069267119..bc4a15b68 100644
--- a/libdnf/dnf-context.cpp
+++ b/libdnf/dnf-context.cpp
@@ -3087,7 +3087,7 @@ static std::vector<std::tuple<libdnf::ModulePackageContainer::ModuleErrorType, s
             }
             for (auto iter = stream_dict.begin(); iter != stream_dict.end(); ) {
                 if (iter->first != enabledOrDefaultStream) {
-                    stream_dict.erase(iter);
+                    stream_dict.erase(iter++);
                 } else {
                     ++iter;
                 }