[Spice-devel] [PATCH spice-gtk 4/7] gst: fix potential null pointer dereference

Marc-André Lureau marcandre.lureau at gmail.com
Mon May 30 17:31:18 UTC 2016


CC       channel-display-gst.lo
channel-display-gst.c: In function ‘new_sample’:
channel-display-gst.c:192:31: error: potential null pointer dereference [-Werror=null-dereference]
                 frame->sample = sample;
                 ~~~~~~~~~~~~~~^~~~~~~~

Signed-off-by: Marc-André Lureau <marcandre.lureau at gmail.com>
---
 src/channel-display-gst.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/channel-display-gst.c b/src/channel-display-gst.c
index 46a85ea..f162078 100644
--- a/src/channel-display-gst.c
+++ b/src/channel-display-gst.c
@@ -189,8 +189,11 @@ static GstFlowReturn new_sample(GstAppSink *gstappsink, gpointer video_decoder)
                 }
 
                 /* The frame is now ready for display */
-                frame->sample = sample;
-                g_queue_push_tail(decoder->display_queue, frame);
+                if (frame) {
+                    frame->sample = sample;
+                    g_queue_push_tail(decoder->display_queue, frame);
+                }
+
                 break;
             }
             l = l->next;
-- 
2.7.4



More information about the Spice-devel mailing list