]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
daemon: plug a memory leak
authorEric Blake <eblake@redhat.com>
Sat, 11 Dec 2010 00:28:58 +0000 (17:28 -0700)
committerEric Blake <eblake@redhat.com>
Mon, 13 Dec 2010 16:49:26 +0000 (09:49 -0700)
* daemon/libvirtd.c (qemudFreeClient): Avoid a leak.
(qemudDispatchServer): Avoid null dereference.

daemon/libvirtd.c

index 791b3dc7b548895c8c7fc31cb21afc5f66aa6de2..2914f2fa8a6415850cf935a2c104165bbfdffc10 100644 (file)
@@ -1410,7 +1410,7 @@ static int qemudDispatchServer(struct qemud_server *server, struct qemud_socket
         /* Client is running as root, so disable auth */
         if (uid == 0) {
             VIR_INFO(_("Turn off polkit auth for privileged client pid %d from %s"),
-                     pid, addrstr);
+                     pid, client->addrstr);
             client->auth = REMOTE_AUTH_NONE;
         }
     }
@@ -1451,7 +1451,7 @@ static int qemudDispatchServer(struct qemud_server *server, struct qemud_socket
         } else {
             PROBE(CLIENT_TLS_FAIL, "fd=%d", client->fd);
             VIR_ERROR(_("TLS handshake failed for client %s: %s"),
-                      addrstr, gnutls_strerror (ret));
+                      client->addrstr, gnutls_strerror (ret));
             goto error;
         }
     }
@@ -2283,6 +2283,7 @@ static void qemudFreeClient(struct qemud_client *client) {
     if (client->conn)
         virConnectClose(client->conn);
     virMutexDestroy(&client->lock);
+    VIR_FREE(client->addrstr);
     VIR_FREE(client);
 }