From 164e4821d0333812b32f9ce9e64133df31dd6443 Mon Sep 17 00:00:00 2001
From: Michal Privoznik <mprivozn@redhat.com>
Date: Thu, 22 Oct 2020 12:49:44 +0200
Subject: [PATCH 070/108] parthelper: Initialize error object
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Some functions called from parthelper can report an error. But
that means that the error object must be initialized otherwise
virResetError() (which happens as a part of virReportError())
will free random pointers.

Reported-by: Katerina Koukiou <kkoukiou@redhat.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
(cherry picked from commit 3b8deb9603fb2a393a28fe4750aba91626619305)
---
 src/storage/parthelper.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/storage/parthelper.c b/src/storage/parthelper.c
index 8278ddf31e..caa2e8fa62 100644
--- a/src/storage/parthelper.c
+++ b/src/storage/parthelper.c
@@ -66,7 +66,8 @@ int main(int argc, char **argv)
     const char *partsep;
     bool devmap_partsep = false;
 
-    if (virGettextInitialize() < 0)
+    if (virGettextInitialize() < 0 ||
+        virErrorInitialize() < 0)
         exit(EXIT_FAILURE);
 
     if (argc == 3 && STREQ(argv[2], "-g")) {
-- 
2.33.0

