Skip to content

Commit

Permalink
value: Cleanup on range parsing failures
Browse files Browse the repository at this point in the history
  • Loading branch information
thiblahute committed Dec 4, 2020
1 parent 322caf8 commit 330450e
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions gst/gstvalue.c
Expand Up @@ -2473,21 +2473,21 @@ _priv_gst_value_parse_range (gchar * s, gchar ** after, GValue * value,

ret = _priv_gst_value_parse_value (s, &s, &value1, type, NULL);
if (!ret)
return FALSE;
goto err;

while (g_ascii_isspace (*s))
s++;

if (*s != ',')
return FALSE;
goto err;
s++;

while (g_ascii_isspace (*s))
s++;

ret = _priv_gst_value_parse_value (s, &s, &value2, type, NULL);
if (!ret)
return FALSE;
goto err;

while (g_ascii_isspace (*s))
s++;
Expand All @@ -2503,7 +2503,7 @@ _priv_gst_value_parse_range (gchar * s, gchar ** after, GValue * value,

ret = _priv_gst_value_parse_value (s, &s, &value3, type, NULL);
if (!ret)
return FALSE;
goto err;

while (g_ascii_isspace (*s))
s++;
Expand All @@ -2513,7 +2513,7 @@ _priv_gst_value_parse_range (gchar * s, gchar ** after, GValue * value,
}

if (*s != ']')
return FALSE;
goto err;
s++;

if (G_VALUE_TYPE (&value1) != G_VALUE_TYPE (&value2))
Expand Down Expand Up @@ -2555,11 +2555,18 @@ _priv_gst_value_parse_range (gchar * s, gchar ** after, GValue * value,
g_value_init (value, range_type);
gst_value_set_fraction_range (value, &value1, &value2);
} else {
return FALSE;
goto err;
}

*after = s;
return TRUE;

err:
g_value_unset (value);
g_value_unset (&value1);
g_value_unset (&value2);
g_value_unset (&value3);
return FALSE;
}

static gboolean
Expand Down

0 comments on commit 330450e

Please sign in to comment.