Plug a mem leak

... and don't call g_strv_length() just to find out if length is == 2 !

==5735== 4 bytes in 1 blocks are definitely lost in loss record 18 of 356
==5735==    at 0x402AD89: malloc (vg_replace_malloc.c:236)
==5735==    by 0x4566BDA: standard_malloc (gmem.c:85)
==5735==    by 0x4566F80: g_malloc (gmem.c:159)
==5735==    by 0x4567282: g_malloc_n (gmem.c:361)
==5735==    by 0x457DFCC: g_strsplit (gstrfuncs.c:2249)
==5735==    by 0x4053934: rsvg_parse_style (rsvg-styles.c:919)
parent 657e84cd
......@@ -918,19 +918,19 @@ parse_style_value (const gchar *string, gchar **value, gboolean *important)
strings = g_strsplit (string, "!", 2);
if (strings[0] == NULL)
return FALSE;
if (strings == NULL || strings[0] == NULL) {
g_strfreev (strings);
return FALSE;
}
if (g_strv_length (strings) == 2 &&
if (strings[1] != NULL && strings[2] == NULL &&
g_str_equal (g_strstrip (strings[1]), "important")) {
*important = TRUE;
} else {
*important = FALSE;
}
if (strings[0])
*value = g_strdup (g_strstrip (strings[0]));
else
*value = g_strdup ("");
*value = g_strdup (g_strstrip (strings[0]));
g_strfreev (strings);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment