提交 1298822e 编写于 作者: J John Ferlan

secret: Alter cleanup path for virSecretObjListGetUUIDs

Rather than using "ret = -1" and cleanup processing, alter the return
path on failure to goto error and then just return the data.got.

In the error path, we no longer check for ret < 0, we just can free
anything added to the array and return -1 directly.
Signed-off-by: NJohn Ferlan <jferlan@redhat.com>
上级 eda1a623
......@@ -626,8 +626,6 @@ virSecretObjListGetUUIDs(virSecretObjListPtr secrets,
virSecretObjListACLFilter filter,
virConnectPtr conn)
{
int ret = -1;
struct virSecretObjListGetHelperData data = {
.conn = conn, .filter = filter, .got = 0,
.uuids = uuids, .nuuids = nuuids, .error = false };
......@@ -637,16 +635,14 @@ virSecretObjListGetUUIDs(virSecretObjListPtr secrets,
virObjectUnlock(secrets);
if (data.error)
goto cleanup;
goto error;
ret = data.got;
return data.got;
cleanup:
if (ret < 0) {
while (data.got)
VIR_FREE(data.uuids[--data.got]);
}
return ret;
error:
while (data.got)
VIR_FREE(data.uuids[--data.got]);
return -1;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册