From: John Ferlan Date: Fri, 12 Sep 2014 12:16:07 +0000 (-0400) Subject: Resolve Coverity CHECKED_RETURN X-Git-Tag: CVE-2014-3633~51 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=07334ccbac01c277bb311ea2512cb44400052586;p=thirdparty%2Flibvirt.git Resolve Coverity CHECKED_RETURN Coverity complained that checking the return of virDomainCreate() was not consistent amongst the callers - so added the return check to the objecteventtest.c and adjust the virt-login-shell to compare < 0 rather than just non zero for the failure condition. --- diff --git a/tests/objecteventtest.c b/tests/objecteventtest.c index 919f559e1f..052dbe5391 100644 --- a/tests/objecteventtest.c +++ b/tests/objecteventtest.c @@ -359,7 +359,8 @@ testDomainStartStopEvent(const void *data) /* Test domain is started */ virDomainDestroy(dom); - virDomainCreate(dom); + if (virDomainCreate(dom) < 0) + goto cleanup; if (virEventRunDefaultImpl() < 0) goto cleanup; diff --git a/tools/virt-login-shell.c b/tools/virt-login-shell.c index be15a32c91..ceb271d070 100644 --- a/tools/virt-login-shell.c +++ b/tools/virt-login-shell.c @@ -275,7 +275,7 @@ main(int argc, char **argv) if (!dom) goto cleanup; - if (!virDomainIsActive(dom) && virDomainCreate(dom)) { + if (!virDomainIsActive(dom) && virDomainCreate(dom) < 0) { virErrorPtr last_error; last_error = virGetLastError(); if (last_error->code != VIR_ERR_OPERATION_INVALID) {