
On 06/03/2010 07:40 AM, Daniel P. Berrange wrote:
When libvirtd exits it is leaving UNIX domain sockets on the filesystem. These need to be removed.
The qemudInitPaths() method has signficant code churn to switch from using a pre-allocated buffer on the stack, to dynamically allocating on the heap.
@@ -549,6 +549,7 @@ static int qemudListenUnix(struct qemud_server *server, sock->port = -1; sock->type = QEMUD_SOCK_TYPE_UNIX; sock->auth = auth; + sock->path = path;
This saves a reference...
- if (qemudInitPaths(server, sockname, roSockname, PATH_MAX) < 0) + if (qemudInitPaths(server, &sockname, &roSockname) < 0) goto cleanup;
if (qemudListenUnix(server, sockname, 0, auth_unix_rw) < 0) goto cleanup; + sockname = NULL;
- if (roSockname[0] != '\0' && qemudListenUnix(server, roSockname, 1, auth_unix_ro) < 0) + if (roSockname != NULL && qemudListenUnix(server, roSockname, 1, auth_unix_ro) < 0) goto cleanup; + roSockname = NULL;
...to malloc'd storage...
@@ -2422,6 +2424,13 @@ static void qemudCleanup(struct qemud_server *server) { if (sock->watch) virEventRemoveHandleImpl(sock->watch); close(sock->fd); + + /* Unlink unix domain sockets which are not in + * the abstract namespace */ + if (sock->path && + sock->path[0] != '@') + unlink(sock->path); +
...but this failed to free that storage. I think you have a leak. ACK, once you add VIR_FREE(sock->path) to qemudCleanup. -- Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org