gupnp/service-action-Do-not-leak-message-if-never-sent.patch

41 lines
1.3 KiB
Diff

From 0f59d903c9db01f7cbe6c2ebede0a570dd29f0f5 Mon Sep 17 00:00:00 2001
From: Jens Georg <mail@jensge.org>
Date: Wed, 19 May 2021 19:42:59 +0200
Subject: [PATCH] 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
--
2.27.0