mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-21 10:52:22 +00:00
virt-host-validate: Initialize the error object
Several libvirt functions are called from virt-host-validate. Some of these functions do report an error on failure. But reporting an error is coupled with freeing previous error (by calling virResetError()). But we've never called virErrorInitialize() and thus resetting error object frees some random pointer. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com> Reviewed-by: Fabiano Fidêncio <fabiano@fidencio.org>
This commit is contained in:
parent
a190906977
commit
e7ae82dcc5
@ -27,6 +27,7 @@
|
||||
#include <getopt.h>
|
||||
|
||||
#include "internal.h"
|
||||
#include "virerror.h"
|
||||
#include "virgettext.h"
|
||||
|
||||
#include "virt-host-validate-common.h"
|
||||
@ -83,8 +84,11 @@ main(int argc, char **argv)
|
||||
bool quiet = false;
|
||||
bool usedHvname = false;
|
||||
|
||||
if (virGettextInitialize() < 0)
|
||||
if (virGettextInitialize() < 0 ||
|
||||
virErrorInitialize() < 0) {
|
||||
fprintf(stderr, _("%s: initialization failed\n"), argv[0]);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
while ((c = getopt_long(argc, argv, "hvq", argOptions, NULL)) != -1) {
|
||||
switch (c) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user