From: Osier Yang Date: Sat, 28 Apr 2012 08:18:44 +0000 (+0800) Subject: storage: Break out the loop if duplicate pool is found X-Git-Tag: v0.9.12-rc1~16 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=980f12be7221b07e569fed24b372ea00c52d9511;p=thirdparty%2Flibvirt.git storage: Break out the loop if duplicate pool is found It doesn't break out the "for" loop even if duplicate pool is found, and thus the "matchpool" could be overriden as NULL again if there is different pool afterwards. To address the problem in libvirt-user list: https://www.redhat.com/archives/libvirt-users/2012-April/msg00150.html --- diff --git a/src/conf/storage_conf.c b/src/conf/storage_conf.c index 6475181c55..3b7879f25b 100644 --- a/src/conf/storage_conf.c +++ b/src/conf/storage_conf.c @@ -1736,6 +1736,9 @@ int virStoragePoolSourceFindDuplicate(virStoragePoolObjListPtr pools, break; } virStoragePoolObjUnlock(pool); + + if (matchpool) + break; } if (matchpool) {