[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [libvirt-php 1/2] Fix memory leak when connection failed



---
 src/libvirt-php.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/src/libvirt-php.c b/src/libvirt-php.c
index 9998fc8..e6a780a 100644
--- a/src/libvirt-php.c
+++ b/src/libvirt-php.c
@@ -788,7 +788,11 @@ PHP_FUNCTION(libvirt_connect)
 		efree(creds);
 	}
 
-	if (conn->conn == NULL) RETURN_FALSE;
+	if (conn->conn == NULL)
+	{
+		efree (conn);
+		RETURN_FALSE;
+	}
 	ZEND_REGISTER_RESOURCE(return_value, conn, le_libvirt_connection);
 	conn->resource_id=Z_LVAL_P(return_value);
 } 
-- 
1.7.3.4
+


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]