[gupnp] service-action: Do not leak message if never sent



commit 0f59d903c9db01f7cbe6c2ebede0a570dd29f0f5
Author: Jens Georg <mail jensge org>
Date:   Wed May 19 19:42:59 2021 +0200

    service-action: Do not leak message if never sent

 libgupnp/gupnp-service-proxy-action.c | 4 ++++
 libgupnp/gupnp-service-proxy.c        | 1 +
 2 files changed, 5 insertions(+)
---
diff --git a/libgupnp/gupnp-service-proxy-action.c b/libgupnp/gupnp-service-proxy-action.c
index 2fd10d5..da41d91 100644
--- a/libgupnp/gupnp-service-proxy-action.c
+++ b/libgupnp/gupnp-service-proxy-action.c
@@ -230,6 +230,10 @@ action_dispose (GUPnPServiceProxyAction *action)
         g_clear_object (&action->cancellable);
         g_clear_error (&action->error);
         g_clear_object (&action->msg);
+        if (action->msg_str != NULL) {
+                g_string_free (action->msg_str, TRUE);
+                action->msg_str = NULL;
+        }
         g_free (action->name);
 }
 
diff --git a/libgupnp/gupnp-service-proxy.c b/libgupnp/gupnp-service-proxy.c
index cec7c8a..0201638 100644
--- a/libgupnp/gupnp-service-proxy.c
+++ b/libgupnp/gupnp-service-proxy.c
@@ -724,6 +724,7 @@ prepare_action_msg (GUPnPServiceProxy              *proxy,
                                   ret->msg_str->len);
 
         g_string_free (ret->msg_str, FALSE);
+        ret->msg_str = NULL;
 }
 
 static void


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