From 791e9170aa7aeb0f8a78d7214a8132659748c225 Mon Sep 17 00:00:00 2001
From: Julian Bouzas <julian.bouzas@collabora.com>
Date: Tue, 28 Apr 2020 11:29:15 -0400
Subject: [PATCH] si-interfaces: transfer full when returning from
 _get_stream_parent_endpoint

---
 lib/wp/session-item.c                    | 3 ++-
 lib/wp/si-interfaces.c                   | 2 +-
 modules/module-si-adapter.c              | 2 +-
 modules/module-si-simple-node-endpoint.c | 2 +-
 modules/module-si-standard-link.c        | 6 ++++--
 tests/wp/endpoint.c                      | 2 +-
 6 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/lib/wp/session-item.c b/lib/wp/session-item.c
index f2c90132..de3459e1 100644
--- a/lib/wp/session-item.c
+++ b/lib/wp/session-item.c
@@ -146,7 +146,8 @@ wp_session_item_default_get_associated_proxy (WpSessionItem * self,
   WpSessionItemPrivate *priv;
 
   if (WP_IS_SI_STREAM (self)) {
-    WpSiEndpoint *ep = wp_si_stream_get_parent_endpoint (WP_SI_STREAM (self));
+    g_autoptr (WpSiEndpoint) ep =
+        wp_si_stream_get_parent_endpoint (WP_SI_STREAM (self));
     priv = wp_session_item_get_instance_private (WP_SESSION_ITEM (ep));
   } else {
     priv = wp_session_item_get_instance_private (self);
diff --git a/lib/wp/si-interfaces.c b/lib/wp/si-interfaces.c
index 3da32ad3..aa8c8046 100644
--- a/lib/wp/si-interfaces.c
+++ b/lib/wp/si-interfaces.c
@@ -251,7 +251,7 @@ wp_si_stream_get_properties (WpSiStream * self)
  * wp_si_stream_get_parent_endpoint: (virtual get_parent_endpoint)
  * @self: the session item
  *
- * Returns: (transfer none): the endpoint that this stream belongs to
+ * Returns: (transfer full): the endpoint that this stream belongs to
  */
 WpSiEndpoint *
 wp_si_stream_get_parent_endpoint (WpSiStream * self)
diff --git a/modules/module-si-adapter.c b/modules/module-si-adapter.c
index d1ebf9e7..4f505757 100644
--- a/modules/module-si-adapter.c
+++ b/modules/module-si-adapter.c
@@ -512,7 +512,7 @@ si_adapter_get_stream_properties (WpSiStream * self)
 static WpSiEndpoint *
 si_adapter_get_stream_parent_endpoint (WpSiStream * self)
 {
-  return WP_SI_ENDPOINT (self);
+  return WP_SI_ENDPOINT (g_object_ref (self));
 }
 
 static void
diff --git a/modules/module-si-simple-node-endpoint.c b/modules/module-si-simple-node-endpoint.c
index 74675504..ad027251 100644
--- a/modules/module-si-simple-node-endpoint.c
+++ b/modules/module-si-simple-node-endpoint.c
@@ -323,7 +323,7 @@ si_simple_node_endpoint_get_stream_registration_info (WpSiStream * self)
 static WpSiEndpoint *
 si_simple_node_endpoint_get_stream_parent_endpoint (WpSiStream * self)
 {
-  return WP_SI_ENDPOINT (self);
+  return WP_SI_ENDPOINT (g_object_ref (self));
 }
 
 static void
diff --git a/modules/module-si-standard-link.c b/modules/module-si-standard-link.c
index 991231e4..3168ef3d 100644
--- a/modules/module-si-standard-link.c
+++ b/modules/module-si-standard-link.c
@@ -327,7 +327,8 @@ si_standard_link_activate_execute_step (WpSessionItem * item,
 
   switch (step) {
   case STEP_ACQUIRE: {
-    WpSiEndpoint *out_endpoint, *in_endpoint;
+    g_autoptr (WpSiEndpoint) out_endpoint = NULL;
+    g_autoptr (WpSiEndpoint) in_endpoint = NULL;
     WpSiStreamAcquisition *out_acquisition, *in_acquisition;
 
     out_endpoint = wp_si_stream_get_parent_endpoint (self->out_stream);
@@ -382,7 +383,8 @@ static void
 si_standard_link_activate_rollback (WpSessionItem * item)
 {
   WpSiStandardLink *self = WP_SI_STANDARD_LINK (item);
-  WpSiEndpoint *out_endpoint, *in_endpoint;
+  g_autoptr (WpSiEndpoint) out_endpoint = NULL;
+  g_autoptr (WpSiEndpoint) in_endpoint = NULL;
   WpSiStreamAcquisition *out_acquisition, *in_acquisition;
 
   out_endpoint = wp_si_stream_get_parent_endpoint (self->out_stream);
diff --git a/tests/wp/endpoint.c b/tests/wp/endpoint.c
index 056a572c..2eb8d85a 100644
--- a/tests/wp/endpoint.c
+++ b/tests/wp/endpoint.c
@@ -84,7 +84,7 @@ test_si_endpoint_get_stream_properties (WpSiStream * self)
 static WpSiEndpoint *
 test_si_endpoint_get_stream_parent_endpoint (WpSiStream * self)
 {
-  return WP_SI_ENDPOINT (self);
+  return WP_SI_ENDPOINT (g_object_ref (self));
 }
 
 static void
-- 
GitLab