vkutils: set the last element of the layer array to NULL
authorMatthew Waters <matthew@centricular.com>
Thu, 1 Sep 2016 09:43:59 +0000 (19:43 +1000)
committerMatthew Waters <matthew@centricular.com>
Thu, 8 Sep 2016 06:14:31 +0000 (16:14 +1000)
g_strv* functions require this to not read off the end of the array.

ext/vulkan/vkutils.c

index 4b547550a4682fadab9dd92c3614e089f8a15892..1c25cb8122c982a853f2eb7da04007dd8274dc98 100644 (file)
@@ -36,6 +36,7 @@ _check_for_all_layers (uint32_t check_count, const char **check_names,
 
   if (check_count <= 0 || layer_count <= 0) {
     GST_WARNING ("no layers requested or supported");
+    *supported_layers = NULL;
     return FALSE;
   }
 
@@ -55,6 +56,7 @@ _check_for_all_layers (uint32_t check_count, const char **check_names,
       GST_WARNING ("Cannot find layer: %s", check_names[i]);
   }
 
+  (*supported_layers)[k] = NULL;
   *supported_layers_count = g_strv_length (*supported_layers);
 
   return TRUE;