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 <bing.niu@intel.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
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;