From df59fdce067a86113721c362c03e57a997937421 Mon Sep 17 00:00:00 2001 From: Daniel Veillard Date: Tue, 17 Mar 2009 11:00:56 +0000 Subject: [PATCH] * src/remote_internal.c: remove file descriptors leak daniel --- ChangeLog | 4 ++++ src/remote_internal.c | 12 +++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 6ea5df5b64..ffa6b0cd7a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +Tue Mar 17 11:58:58 CET 2009 Daniel Veillard + + * src/remote_internal.c: remove file descriptors leak + Mon Mar 16 13:17:05 EDT 2009 Cole Robinson * src/libvirt.c: Don't allow readonly connections to dump secure xml. diff --git a/src/remote_internal.c b/src/remote_internal.c index 1a8b4e0e24..9e6304b116 100644 --- a/src/remote_internal.c +++ b/src/remote_internal.c @@ -332,7 +332,7 @@ doRemoteOpen (virConnectPtr conn, virConnectAuthPtr auth ATTRIBUTE_UNUSED, int flags) { - int wakeupFD[2]; + int wakeupFD[2] = { -1, -1 }; char *transport_str = NULL; if (conn->uri) { @@ -885,6 +885,11 @@ doRemoteOpen (virConnectPtr conn, #endif } + if (wakeupFD[0] >= 0) { + close(wakeupFD[0]); + close(wakeupFD[1]); + } + VIR_FREE(priv->hostname); goto cleanup; } @@ -1350,6 +1355,11 @@ doRemoteClose (virConnectPtr conn, struct private_data *priv) } while (reap != -1 && reap != priv->pid); } #endif + if (priv->wakeupReadFD >= 0) { + close(priv->wakeupReadFD); + close(priv->wakeupSendFD); + } + /* Free hostname copy */ free (priv->hostname);