[libvirt] [PATCH] remote: Add missing virCondDestroy calls

The virCond of the remote_thread_call struct was leaked in some places. This results in leaking the underlying mutex. Which in turn leaks a handle on Windows. Reported by Aliaksandr Chabatar and Ihar Smertsin. --- See https://www.redhat.com/archives/libvir-list/2011-March/msg00789.html for the report. src/remote/remote_driver.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c index 82e094b..8aa8801 100644 --- a/src/remote/remote_driver.c +++ b/src/remote/remote_driver.c @@ -8609,6 +8609,7 @@ remoteStreamPacket(virStreamPtr st, xdr_destroy (&xdr); ret = remoteIO(st->conn, priv, 0, thiscall); + ignore_value(virCondDestroy(&thiscall->cond)); VIR_FREE(thiscall); if (ret < 0) return -1; @@ -8617,6 +8618,7 @@ remoteStreamPacket(virStreamPtr st, error: xdr_destroy (&xdr); + ignore_value(virCondDestroy(&thiscall->cond)); VIR_FREE(thiscall); return -1; } @@ -8746,6 +8748,7 @@ remoteStreamRecv(virStreamPtr st, } ret = remoteIO(st->conn, priv, 0, thiscall); + ignore_value(virCondDestroy(&thiscall->cond)); VIR_FREE(thiscall); if (ret < 0) goto cleanup; @@ -9719,6 +9722,7 @@ prepareCall(struct private_data *priv, error: xdr_destroy (&xdr); + ignore_value(virCondDestroy(&rv->cond)); VIR_FREE(rv); return NULL; } @@ -10818,6 +10822,7 @@ call (virConnectPtr conn, struct private_data *priv, } rv = remoteIO(conn, priv, flags, thiscall); + ignore_value(virCondDestroy(&thiscall->cond)); VIR_FREE(thiscall); return rv; } -- 1.7.0.4

On 03/17/2011 12:52 PM, Matthias Bolte wrote:
The virCond of the remote_thread_call struct was leaked in some places. This results in leaking the underlying mutex. Which in turn leaks a handle on Windows.
Reported by Aliaksandr Chabatar and Ihar Smertsin. ---
See https://www.redhat.com/archives/libvir-list/2011-March/msg00789.html for the report.
ACK. Looks like you got them all. (I checked other uses of virCondInit for appropriate matching virCondDestroy too, and at least my quick look showed them all matched up).

2011/3/17 Laine Stump <laine@laine.org>:
On 03/17/2011 12:52 PM, Matthias Bolte wrote:
The virCond of the remote_thread_call struct was leaked in some places. This results in leaking the underlying mutex. Which in turn leaks a handle on Windows.
Reported by Aliaksandr Chabatar and Ihar Smertsin. ---
See https://www.redhat.com/archives/libvir-list/2011-March/msg00789.html for the report.
ACK. Looks like you got them all. (I checked other uses of virCondInit for appropriate matching virCondDestroy too, and at least my quick look showed them all matched up).
Yep, I did the same and only found the remote driver affected. Thanks, pushed. Matthias

On 03/17/2011 10:52 AM, Matthias Bolte wrote:
The virCond of the remote_thread_call struct was leaked in some places. This results in leaking the underlying mutex. Which in turn leaks a handle on Windows.
Reported by Aliaksandr Chabatar and Ihar Smertsin. ---
See https://www.redhat.com/archives/libvir-list/2011-March/msg00789.html for the report.
src/remote/remote_driver.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c index 82e094b..8aa8801 100644 --- a/src/remote/remote_driver.c +++ b/src/remote/remote_driver.c @@ -8609,6 +8609,7 @@ remoteStreamPacket(virStreamPtr st, xdr_destroy (&xdr);
ret = remoteIO(st->conn, priv, 0, thiscall); + ignore_value(virCondDestroy(&thiscall->cond)); VIR_FREE(thiscall);
ACK. -- Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org
participants (3)
-
Eric Blake
-
Laine Stump
-
Matthias Bolte