提交 70e9114e 编写于 作者: J John Ferlan

admin: Clean up error path in adminServerListClients

Coverity noted that in adminServerListClients if virNetServerGetClients
returns a -1 into ret, then the call virObjectListFreeCount in cleanup
will not be very happy.

Adjust the code to skip the cleanup label and just return -1 if
virNetServerGetClients fails.
Signed-off-by: NJohn Ferlan <jferlan@redhat.com>
上级 4fac5a9f
...@@ -191,14 +191,13 @@ adminServerListClients(virNetServerPtr srv, ...@@ -191,14 +191,13 @@ adminServerListClients(virNetServerPtr srv,
virCheckFlags(0, -1); virCheckFlags(0, -1);
if ((ret = virNetServerGetClients(srv, &clts)) < 0) if ((ret = virNetServerGetClients(srv, &clts)) < 0)
goto cleanup; return -1;
if (clients) { if (clients) {
*clients = clts; *clients = clts;
clts = NULL; clts = NULL;
} }
cleanup:
virObjectListFreeCount(clts, ret); virObjectListFreeCount(clts, ret);
return ret; return ret;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册