[gupnp] ServiceProxy: Do not leak the action body



commit 0cb305b4ae1e7f999392aa69d549bce4827eb1a3
Author: Jens Georg <mail jensge org>
Date:   Sat Jan 1 19:11:25 2022 +0100

    ServiceProxy: Do not leak the action body

 libgupnp/gupnp-service-proxy.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
---
diff --git a/libgupnp/gupnp-service-proxy.c b/libgupnp/gupnp-service-proxy.c
index 24a99c6..3c65414 100644
--- a/libgupnp/gupnp-service-proxy.c
+++ b/libgupnp/gupnp-service-proxy.c
@@ -691,10 +691,12 @@ prepare_action_msg (GUPnPServiceProxy *proxy,
 
         gupnp_service_proxy_action_serialize (action, service_type);
 
-        soup_message_set_request_body_from_bytes (
-                action->msg,
-                "text/xml; charset=\"utf-8\"",
-                g_string_free_to_bytes (action->msg_str));
+        GBytes *body = g_string_free_to_bytes (action->msg_str);
+
+        soup_message_set_request_body_from_bytes (action->msg,
+                                                  "text/xml; charset=\"utf-8\"",
+                                                  body);
+        g_bytes_unref (body);
         action->msg_str = NULL;
 
         return TRUE;


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