]> xenbits.xensource.com Git - libvirt.git/commitdiff
parthelper: Initialize error object
authorMichal Privoznik <mprivozn@redhat.com>
Thu, 22 Oct 2020 10:49:44 +0000 (12:49 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Thu, 22 Oct 2020 11:47:23 +0000 (13:47 +0200)
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>
src/storage/parthelper.c

index 812e90d3cb0de037a2bf4a328f6d54e392354292..29a01d3dd52cbc73ff9ba4c6d2fb73d6680efb88 100644 (file)
@@ -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")) {