]> xenbits.xensource.com Git - libvirt.git/commitdiff
conf: Add return value check to virResctrlAllocForeachCache
authorBing Niu <bing.niu@intel.com>
Mon, 30 Jul 2018 03:12:40 +0000 (11:12 +0800)
committerJohn Ferlan <jferlan@redhat.com>
Mon, 13 Aug 2018 18:19:41 +0000 (14:19 -0400)
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>
src/conf/domain_conf.c

index 24c0ec2798f7c9a952606d1887a34900579f48de..77cc73744f24c26de0f9027e9054051691cea3de 100644 (file)
@@ -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;