Index: libvirt-0.7.1/qemud/dispatch.c =================================================================== --- libvirt-0.7.1.orig/qemud/dispatch.c +++ libvirt-0.7.1/qemud/dispatch.c @@ -191,6 +191,7 @@ remoteSerializeError(struct qemud_client xdr_error: xdr_destroy(&xdr); + VIR_FREE(msg); fatal_error: xdr_free((xdrproc_t)xdr_remote_error, (char *)rerr); return -1; @@ -336,6 +337,7 @@ remoteDispatchClientRequest (struct qemu struct qemud_client *client, struct qemud_client_message *msg) { + int ret; remote_error rerr; memset(&rerr, 0, sizeof rerr); @@ -364,7 +366,12 @@ remoteDispatchClientRequest (struct qemu } error: - return remoteSerializeReplyError(client, &rerr, &msg->hdr); + ret = remoteSerializeReplyError(client, &rerr, &msg->hdr); + + if (ret >= 0) + VIR_FREE(msg); + + return ret; } @@ -521,8 +528,12 @@ remoteDispatchClientCall (struct qemud_s rpc_error: /* Semi-bad stuff happened, we can still try to send back * an RPC error message to client */ - return remoteSerializeReplyError(client, &rerr, &msg->hdr); + rv = remoteSerializeReplyError(client, &rerr, &msg->hdr); + + if (rv >= 0) + VIR_FREE(msg); + return rv; xdr_error: /* Seriously bad stuff happened, so we'll kill off this client