diff --git a/daemon/stream.c b/daemon/stream.c index 685cee2e0f..56d79c2b6c 100644 --- a/daemon/stream.c +++ b/daemon/stream.c @@ -327,6 +327,7 @@ int daemonFreeClientStream(virNetServerClientPtr client, virNetMessagePtr tmp = msg->next; /* Send a dummy reply to free up 'msg' & unblock client rx */ memset(msg, 0, sizeof(*msg)); + msg->header.type = VIR_NET_REPLY; if (virNetServerClientSendMessage(client, msg) < 0) { virNetServerClientMarkClose(client); virNetMessageFree(msg); diff --git a/src/rpc/virnetserverprogram.c b/src/rpc/virnetserverprogram.c index 4afed64c6e..ca80ae09ed 100644 --- a/src/rpc/virnetserverprogram.c +++ b/src/rpc/virnetserverprogram.c @@ -259,7 +259,13 @@ int virNetServerProgramDispatch(virNetServerProgramPtr prog, */ VIR_INFO("Ignoring unexpected stream data serial=%d proc=%d status=%d", msg->header.serial, msg->header.proc, msg->header.status); - virNetMessageFree(msg); + /* Send a dummy reply to free up 'msg' & unblock client rx */ + memset(msg, 0, sizeof(*msg)); + msg->header.type = VIR_NET_REPLY; + if (virNetServerClientSendMessage(client, msg) < 0) { + ret = -1; + goto cleanup; + } ret = 0; break; @@ -275,6 +281,7 @@ int virNetServerProgramDispatch(virNetServerProgramPtr prog, error: ret = virNetServerProgramSendReplyError(prog, client, msg, &rerr, &msg->header); +cleanup: return ret; }