parthelper: Initialize error object

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>
This commit is contained in:
Michal Privoznik 2020-10-22 12:49:44 +02:00
parent 7b1ed1cd73
commit 3b8deb9603

View 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")) {