Commit 3f2084a5 authored by Ivan Frade's avatar Ivan Frade

libtracker-extract: Do not leak GMatchInfo objects.

Glib doc:
A GMatchInfo structure, used to get information on the match,
is stored in match_info if not NULL. Note that if match_info
is not NULL then it is created even if the function returns FALSE,
 i.e. you must free it regardless if regular expression actually matched.
parent 6dc3f41e
......@@ -153,9 +153,11 @@ gps_coordinate_dup (const gchar *coordinates)
g_free (deg);
g_free (min);
g_free (ref);
g_match_info_free (info);
return g_strdup_printf ("%f", r);
} else {
g_match_info_free (info);
return NULL;
}
}
......@@ -324,7 +326,7 @@ static gint
get_region_counter (const gchar *path)
{
static GRegex *regex = NULL;
GMatchInfo *match_info;
GMatchInfo *match_info = NULL;
gchar *match;
gint result;
......@@ -333,6 +335,7 @@ get_region_counter (const gchar *path)
}
if (!g_regex_match (regex, path, 0, &match_info)) {
g_match_info_free (match_info);
return -1;
}
......
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