qemu_capabilities: Resolve Coverity NULL_RETURNS

Adjust the initialization of qemuCaps() to check for a NULL before
attempting to dereference like other callers/users do.
This commit is contained in:
John Ferlan 2014-08-27 09:43:52 -04:00
parent 9d7254de43
commit cabebc0c56

View File

@ -3349,10 +3349,13 @@ virQEMUCapsPtr virQEMUCapsNewForBinary(const char *binary,
uid_t runUid, uid_t runUid,
gid_t runGid) gid_t runGid)
{ {
virQEMUCapsPtr qemuCaps = virQEMUCapsNew(); virQEMUCapsPtr qemuCaps;
struct stat sb; struct stat sb;
int rv; int rv;
if (!(qemuCaps = virQEMUCapsNew()))
goto error;
if (VIR_STRDUP(qemuCaps->binary, binary) < 0) if (VIR_STRDUP(qemuCaps->binary, binary) < 0)
goto error; goto error;