[tracker] libtracker-common: Fix memory leak in tracker_string_to_date
- From: JÃrg Billeter <juergbi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker] libtracker-common: Fix memory leak in tracker_string_to_date
- Date: Tue, 13 Dec 2011 16:39:34 +0000 (UTC)
commit d30e115a18f39eb854ef97057b37df2ff264b4ee
Author: JÃrg Billeter <j bitron ch>
Date: Tue Dec 13 17:23:06 2011 +0100
libtracker-common: Fix memory leak in tracker_string_to_date
Fixes NB#294705.
src/libtracker-common/tracker-date-time.c | 9 ++++++---
1 files changed, 6 insertions(+), 3 deletions(-)
---
diff --git a/src/libtracker-common/tracker-date-time.c b/src/libtracker-common/tracker-date-time.c
index c1570b9..eb53385 100644
--- a/src/libtracker-common/tracker-date-time.c
+++ b/src/libtracker-common/tracker-date-time.c
@@ -57,6 +57,7 @@ tracker_string_to_date (const gchar *date_string,
struct tm tm;
gdouble t;
gint offset;
+ gboolean timezoned;
g_return_val_if_fail (date_string, -1);
@@ -112,9 +113,11 @@ tracker_string_to_date (const gchar *date_string,
g_free (match);
match = g_match_info_fetch (match_info, 8);
- if (match && strlen (match) > 0) {
+ timezoned = (match && strlen (match) > 0);
+ g_free (match);
+
+ if (timezoned) {
/* timezoned */
- g_free (match);
/* mktime() always assumes that "tm" is in locale time but we
* want to keep control on time, so we go to UTC
@@ -183,8 +186,8 @@ tracker_string_to_date (const gchar *date_string,
we're interested in a maximum of 3 decimal places (milliseconds) */
memcpy (milliseconds, match + 1, MIN (3, strlen (match + 1)));
t += (gdouble) atoi (milliseconds) / 1000;
- g_free (match);
}
+ g_free (match);
g_match_info_free (match_info);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]