提交 24384a75 编写于 作者: E Eric Blake

daemon: plug a memory leak

* daemon/libvirtd.c (qemudFreeClient): Avoid a leak.
(qemudDispatchServer): Avoid null dereference.
上级 013c000a
...@@ -1410,7 +1410,7 @@ static int qemudDispatchServer(struct qemud_server *server, struct qemud_socket ...@@ -1410,7 +1410,7 @@ static int qemudDispatchServer(struct qemud_server *server, struct qemud_socket
/* Client is running as root, so disable auth */ /* Client is running as root, so disable auth */
if (uid == 0) { if (uid == 0) {
VIR_INFO(_("Turn off polkit auth for privileged client pid %d from %s"), VIR_INFO(_("Turn off polkit auth for privileged client pid %d from %s"),
pid, addrstr); pid, client->addrstr);
client->auth = REMOTE_AUTH_NONE; client->auth = REMOTE_AUTH_NONE;
} }
} }
...@@ -1451,7 +1451,7 @@ static int qemudDispatchServer(struct qemud_server *server, struct qemud_socket ...@@ -1451,7 +1451,7 @@ static int qemudDispatchServer(struct qemud_server *server, struct qemud_socket
} else { } else {
PROBE(CLIENT_TLS_FAIL, "fd=%d", client->fd); PROBE(CLIENT_TLS_FAIL, "fd=%d", client->fd);
VIR_ERROR(_("TLS handshake failed for client %s: %s"), VIR_ERROR(_("TLS handshake failed for client %s: %s"),
addrstr, gnutls_strerror (ret)); client->addrstr, gnutls_strerror (ret));
goto error; goto error;
} }
} }
...@@ -2283,6 +2283,7 @@ static void qemudFreeClient(struct qemud_client *client) { ...@@ -2283,6 +2283,7 @@ static void qemudFreeClient(struct qemud_client *client) {
if (client->conn) if (client->conn)
virConnectClose(client->conn); virConnectClose(client->conn);
virMutexDestroy(&client->lock); virMutexDestroy(&client->lock);
VIR_FREE(client->addrstr);
VIR_FREE(client); VIR_FREE(client);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册