validate-utils: Add NULL check
authorEdward Hervey <edward@centricular.com>
Tue, 18 Jul 2017 13:38:04 +0000 (15:38 +0200)
committerEdward Hervey <bilboed@bilboed.com>
Tue, 18 Jul 2017 13:38:04 +0000 (15:38 +0200)
Unlikely to be triggered. And fix typo at the same time

CID #1415464

validate/gst/validate/gst-validate-utils.c

index f90231b..a54cd99 100644 (file)
@@ -583,11 +583,14 @@ _get_lines (const gchar * scenario_file)
 
 /* Returns: (transfer full): a #GList of #GstStructure */
 static GList *
-_lines_get_strutures (gchar ** lines)
+_lines_get_structures (gchar ** lines)
 {
   gint i;
   GList *structures = NULL;
 
+  if (lines == NULL)
+    return NULL;
+
   for (i = 0; lines[i]; i++) {
     GstStructure *structure;
 
@@ -604,8 +607,7 @@ _lines_get_strutures (gchar ** lines)
   }
 
 done:
-  if (lines)
-    g_strfreev (lines);
+  g_strfreev (lines);
 
   return structures;
 
@@ -632,7 +634,7 @@ gst_validate_utils_structs_parse_from_filename (const gchar * scenario_file)
     return NULL;
   }
 
-  return _lines_get_strutures (lines);
+  return _lines_get_structures (lines);
 }
 
 /**
@@ -648,7 +650,7 @@ gst_validate_structs_parse_from_gfile (GFile * scenario_file)
   if (lines == NULL)
     return NULL;
 
-  return _lines_get_strutures (lines);
+  return _lines_get_structures (lines);
 }
 
 static gboolean