{
GString *ret = g_string_sized_new (4);
gchar *expect, *want;
+ gchar *orig_want;
int len;
+ gboolean discard_output = TRUE;
if (g_ascii_strcasecmp (expected, wanted) == 0) {
g_string_free (ret, TRUE);
}
expect = g_ascii_strdown (expected, -1);
- want = g_ascii_strdown (wanted, -1);
+ orig_want = want = g_ascii_strdown (wanted, -1);
if (strcmp (expect, "rgb16") == 0 || strcmp (expect, "bgr16") == 0) {
gchar *temp = expect;
if (strcmp (want, "rgb16") == 0 || strcmp (want, "bgr16") == 0) {
gchar *temp = want;
- want = g_strndup (temp, 3);
+ orig_want = want = g_strndup (temp, 3);
g_free (temp);
}
len++;
}
g_free (want);
- want = new_want;
+ orig_want = want = new_want;
}
/* pad expect with 'a's */
if (!(val = strchr (expect, needle))
&& needle == 'a' && !(val = strchr (expect, 'x')))
- goto fail;
+ goto out;
idx = (gint) (val - expect);
want = &want[1];
}
- return g_string_free (ret, FALSE);
+ discard_output = FALSE;
+out:
+ g_free (orig_want);
+ g_free (expect);
-fail:
- g_string_free (ret, TRUE);
- return NULL;
+ return g_string_free (ret, discard_output);
}
static void