If the 'nleases < 0' on return, then the subsequent call to
findLeaseInJSON will not produce the expected results (passed
in as a size_t, but nleases is a ssize_t). So check if the
returned value < 0 and if so, goto cleanup.
Found by Coverity as a NEGATIVE_RETURNS event
}
VIR_DIR_CLOSE(dir);
- nleases = virJSONValueArraySize(leases_array);
+ if ((nleases = virJSONValueArraySize(leases_array)) < 0)
+ goto cleanup;
DEBUG("Read %zd leases", nleases);
#if !defined(LIBVIRT_NSS_GUEST)