[Spice-devel] [PATCH spice v2 2/2] Do not crash on NULL codecs

Pavel Grunt pgrunt at redhat.com
Wed Nov 16 09:10:01 UTC 2016


---
 server/reds.c                            | 2 +-
 server/tests/spice-codecs-parsing-test.c | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/server/reds.c b/server/reds.c
index 12a274c..eccc2ba 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -3639,7 +3639,7 @@ static void reds_set_video_codecs(RedsState *reds, const char *codecs)
 {
     char *encoder_name, *codec_name;
 
-    if (strcmp(codecs, "auto") == 0) {
+    if (codecs == NULL || strcmp(codecs, "auto") == 0) {
         codecs = default_video_codecs;
     }
 
diff --git a/server/tests/spice-codecs-parsing-test.c b/server/tests/spice-codecs-parsing-test.c
index b679686..9d9da0b 100644
--- a/server/tests/spice-codecs-parsing-test.c
+++ b/server/tests/spice-codecs-parsing-test.c
@@ -28,6 +28,7 @@ static void codecs_good(void)
 {
     guint i;
     const gchar *codecs[] = {
+        NULL,
         "",
         "spice:mjpeg",
         "spice:mjpeg;;;",
-- 
2.10.2



More information about the Spice-devel mailing list