There's a bug in the function. When closing a stream, the stream
refcount should be decremented. We have a helper function for that
which (among others) take a virConnectPtr as an argument. However,
we are passing an internal representation of the virConnect.
Even gcc warns about this:

libvirt-php.c: In function ‘zif_libvirt_stream_close’:
libvirt-php.c:3748:47: warning: passing argument 2 of ‘resource_change_counter’ 
from incompatible pointer type
  resource_change_counter(INT_RESOURCE_STREAM, stream->conn, stream->stream, 0 
TSRMLS_CC);
                                               ^
libvirt-php.c:470:5: note: expected ‘virConnectPtr’ but argument is of type 
‘struct php_libvirt_connection *’
 int resource_change_counter(int type, virConnectPtr conn, void *memp, int inc 
TSRMLS_DC)
     ^
Signed-off-by: Michal Privoznik <[email protected]>

Signed-off-by: Michal Privoznik <[email protected]>
---
 src/libvirt-php.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/libvirt-php.c b/src/libvirt-php.c
index 4f9f179..3336ea8 100644
--- a/src/libvirt-php.c
+++ b/src/libvirt-php.c
@@ -3744,7 +3744,7 @@ PHP_FUNCTION(libvirt_stream_close)
         RETURN_LONG(retval);
     }
 
-    resource_change_counter(INT_RESOURCE_STREAM, stream->conn, stream->stream, 
0 TSRMLS_CC);
+    resource_change_counter(INT_RESOURCE_STREAM, stream->conn->conn, 
stream->stream, 0 TSRMLS_CC);
     RETURN_LONG(retval);
 }
 
-- 
2.3.6

--
libvir-list mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/libvir-list

Reply via email to