[gupnp] [PATCH] Add sanity checks to GUPnPServiceProxyAction API



Check that a GUPnPServiceProxyAction is used with the
GUPnPServiceProxy object that it was created for.
---
 libgupnp/gupnp-service-proxy.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/libgupnp/gupnp-service-proxy.c b/libgupnp/gupnp-service-proxy.c
index 06008b5..3400576 100644
--- a/libgupnp/gupnp-service-proxy.c
+++ b/libgupnp/gupnp-service-proxy.c
@@ -1229,6 +1229,7 @@ gupnp_service_proxy_end_action_valist (GUPnPServiceProxy       *proxy,
 
         g_return_val_if_fail (GUPNP_IS_SERVICE_PROXY (proxy), FALSE);
         g_return_val_if_fail (action, FALSE);
+        g_return_val_if_fail (proxy == action->proxy, FALSE);
 
         /* Check for saved error from begin_action() */
         if (action->error) {
@@ -1321,6 +1322,7 @@ gupnp_service_proxy_end_action_list (GUPnPServiceProxy       *proxy,
 
         g_return_val_if_fail (GUPNP_IS_SERVICE_PROXY (proxy), FALSE);
         g_return_val_if_fail (action, FALSE);
+        g_return_val_if_fail (proxy == action->proxy, FALSE);
 
         /* Check for saved error from begin_action() */
         if (action->error) {
@@ -1391,6 +1393,7 @@ gupnp_service_proxy_end_action_hash (GUPnPServiceProxy       *proxy,
 
         g_return_val_if_fail (GUPNP_IS_SERVICE_PROXY (proxy), FALSE);
         g_return_val_if_fail (action, FALSE);
+        g_return_val_if_fail (proxy == action->proxy, FALSE);
 
         /* Check for saved error from begin_action() */
         if (action->error) {
@@ -1439,6 +1442,7 @@ gupnp_service_proxy_cancel_action (GUPnPServiceProxy       *proxy,
 
         g_return_if_fail (GUPNP_IS_SERVICE_PROXY (proxy));
         g_return_if_fail (action);
+        g_return_if_fail (proxy == action->proxy);
 
         if (action->msg != NULL) {
                 context = gupnp_service_info_get_context
-- 
1.7.1

--
To unsubscribe send a mail to gupnp+unsubscribe\@o-hand.com



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