[Spice-devel] [spice-gtk v2 11/16] channel: avoid crash on CHANNEL_DEBUG due NULL channel

Victor Toso victortoso at redhat.com
Mon May 23 11:50:48 UTC 2016


---
 src/spice-channel-priv.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/spice-channel-priv.h b/src/spice-channel-priv.h
index 50aca5c..dcb5377 100644
--- a/src/spice-channel-priv.h
+++ b/src/spice-channel-priv.h
@@ -41,7 +41,9 @@ G_BEGIN_DECLS
 #define MAX_SPICE_DATA_HEADER_SIZE sizeof(SpiceDataHeader)
 
 #define CHANNEL_DEBUG(channel, fmt, ...) \
-    SPICE_DEBUG("%s: " fmt, SPICE_CHANNEL(channel)->priv->name, ## __VA_ARGS__)
+    SPICE_DEBUG("%s: " fmt, \
+            (channel) ? SPICE_CHANNEL(channel)->priv->name : "no-channel", \
+            ## __VA_ARGS__)
 
 struct _SpiceMsgOut {
     int                   refcount;
-- 
2.5.5



More information about the Spice-devel mailing list