From: Bing Niu Date: Mon, 30 Jul 2018 03:12:40 +0000 (+0800) Subject: conf: Add return value check to virResctrlAllocForeachCache X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=8d6f508e64728f9aaa5a624462ac0da325854cad;p=libvirt.git conf: Add return value check to virResctrlAllocForeachCache Add return value check to virResctrlAllocForeachCache in virDomainCachetuneDefFormat. The virResctrlAllocForeachCache does have return value, so need check return value to make sure function executed without error. Signed-off-by: Bing Niu Reviewed-by: John Ferlan --- diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 24c0ec2798..77cc73744f 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -27294,10 +27294,10 @@ virDomainCachetuneDefFormat(virBufferPtr buf, int ret = -1; virBufferSetChildIndent(&childrenBuf, buf); - virResctrlAllocForeachCache(resctrl->alloc, - virDomainCachetuneDefFormatHelper, - &childrenBuf); - + if (virResctrlAllocForeachCache(resctrl->alloc, + virDomainCachetuneDefFormatHelper, + &childrenBuf) < 0) + goto cleanup; if (virBufferCheckError(&childrenBuf) < 0) goto cleanup;