[gnome-todo] todo.txt: fix possible memory leak



commit 32edb1776c6dd0dab936c1815988d2bc58c646b7
Author: Mohammed Sadiq <sadiq sadiqpk org>
Date:   Sun Apr 9 11:58:46 2017 +0530

    todo.txt: fix possible memory leak
    
    https://bugzilla.gnome.org/show_bug.cgi?id=781086

 plugins/todo-txt/gtd-todo-txt-parser.c |   13 ++++---------
 1 files changed, 4 insertions(+), 9 deletions(-)
---
diff --git a/plugins/todo-txt/gtd-todo-txt-parser.c b/plugins/todo-txt/gtd-todo-txt-parser.c
index e017417..a1f96cb 100644
--- a/plugins/todo-txt/gtd-todo-txt-parser.c
+++ b/plugins/todo-txt/gtd-todo-txt-parser.c
@@ -118,17 +118,12 @@ gtd_todo_txt_parser_get_date (gchar *token)
 gboolean
 gtd_todo_txt_parser_is_date (gchar *dt)
 {
-  GDate   *date = NULL;
+  GDate  date;
 
-  date = g_date_new ();
-  g_date_set_parse (date, dt);
-
-  if (!g_date_valid (date))
-    return FALSE;
+  g_date_clear (&date, 1);
+  g_date_set_parse (&date, dt);
 
-  g_date_free (date);
-
-  return TRUE;
+  return g_date_valid (&date);
 }
 
 gboolean


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]