[gupnp] service: Prevent critical on notify error



commit b2fbaebb433dcf903f532580ad7dad9f8675bf00
Author: Jens Georg <mail jensge org>
Date:   Wed May 25 16:57:58 2022 +0200

    service: Prevent critical on notify error
    
    The code did not handle the case nicelz where error wasn't "cancelled",
    using a NULL pointer from the reason phrase.

 libgupnp/gupnp-service.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)
---
diff --git a/libgupnp/gupnp-service.c b/libgupnp/gupnp-service.c
index 2c5f6ce..d515a87 100644
--- a/libgupnp/gupnp-service.c
+++ b/libgupnp/gupnp-service.c
@@ -1428,10 +1428,17 @@ notify_got_response (GObject *source, GAsyncResult *res, gpointer user_data)
                         /* Emit 'notify-failed' signal */
                         GError *inner_error;
 
-                        inner_error = g_error_new_literal (
-                                GUPNP_EVENTING_ERROR,
-                                GUPNP_EVENTING_ERROR_NOTIFY_FAILED,
-                                soup_message_get_reason_phrase (data->msg));
+                        // We have an error, so just propagate that
+                        if (error != NULL) {
+                                g_propagate_error (&inner_error,
+                                                   g_steal_pointer (&error));
+                        } else {
+                                inner_error = g_error_new_literal (
+                                        GUPNP_EVENTING_ERROR,
+                                        GUPNP_EVENTING_ERROR_NOTIFY_FAILED,
+                                        soup_message_get_reason_phrase (
+                                                data->msg));
+                        }
 
                         g_signal_emit (data->data->service,
                                        signals[NOTIFY_FAILED],


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