Move the declaration and assignment of 'buffer' into
the if (sample) block, where sample is not NULL.

Signed-off-by: Uri Lublin <u...@redhat.com>
---
 src/channel-display-gst.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/channel-display-gst.c b/src/channel-display-gst.c
index 3f51361..03c6044 100644
--- a/src/channel-display-gst.c
+++ b/src/channel-display-gst.c
@@ -200,8 +200,8 @@ static GstFlowReturn new_sample(GstAppSink *gstappsink, 
gpointer video_decoder)
     SpiceGstDecoder *decoder = video_decoder;
 
     GstSample *sample = gst_app_sink_pull_sample(decoder->appsink);
-    GstBuffer *buffer = sample ? gst_sample_get_buffer(sample) : NULL;
     if (sample) {
+        GstBuffer *buffer = gst_sample_get_buffer(sample);
         g_mutex_lock(&decoder->queues_mutex);
 
         /* gst_app_sink_pull_sample() sometimes returns the same buffer twice
-- 
2.13.3

_______________________________________________
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/spice-devel

Reply via email to