From: John Ferlan Date: Mon, 18 Jul 2016 18:25:43 +0000 (-0400) Subject: tests: Need to check return of virGetLastError X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=5ddaa7ef2d8fd78b95f4d6595f972c6462eaafd3;p=libvirt.git tests: Need to check return of virGetLastError Cannot assume virGetLastError returns non-NULL value - modify the code to fetch err and check if err && err->code Found by Coverity Signed-off-by: John Ferlan --- diff --git a/tests/qemuhelptest.c b/tests/qemuhelptest.c index 8aac9974a8..7c8b84133c 100644 --- a/tests/qemuhelptest.c +++ b/tests/qemuhelptest.c @@ -60,7 +60,9 @@ static int testHelpStrParsing(const void *data) if (virQEMUCapsParseHelpStr("QEMU", help, flags, &version, &is_kvm, &kvm_version, false, NULL) == -1) { - if (info->error && virGetLastError()->code == info->error) + virErrorPtr err = virGetLastError(); + + if (info->error && err && err->code == info->error) ret = 0; goto cleanup; }