Skip to content
Snippets Groups Projects
Commit c1aaeaff authored by Tristan Matthews's avatar Tristan Matthews
Browse files

* #6623: fixed more leaks

parent af6a0d01
Branches
Tags
No related merge requests found
...@@ -414,8 +414,6 @@ history_state_t get_history_state_from_id (gchar *indice) ...@@ -414,8 +414,6 @@ history_state_t get_history_state_from_id (gchar *indice)
gchar* get_call_duration (callable_obj_t *obj) gchar* get_call_duration (callable_obj_t *obj)
{ {
gchar *res;
int duration; int duration;
time_t start, end; time_t start, end;
...@@ -426,21 +424,24 @@ gchar* get_call_duration (callable_obj_t *obj) ...@@ -426,21 +424,24 @@ gchar* get_call_duration (callable_obj_t *obj)
return g_markup_printf_escaped ("<small>Duration:</small> 0:00"); return g_markup_printf_escaped ("<small>Duration:</small> 0:00");
duration = (int) difftime (end, start); duration = (int) difftime (end, start);
gchar *result;
if (duration / 60 == 0) { if (duration / 60 == 0) {
if (duration < 10) if (duration < 10)
res = g_markup_printf_escaped ("00:0%i", duration); result = g_markup_printf_escaped ("00:0%i", duration);
else else
res = g_markup_printf_escaped ("00:%i", duration); result = g_markup_printf_escaped ("00:%i", duration);
} else { } else {
if (duration%60 < 10) if (duration%60 < 10)
res = g_markup_printf_escaped ("%i:0%i" , duration/60 , duration%60); result = g_markup_printf_escaped ("%i:0%i" , duration/60 , duration%60);
else else
res = g_markup_printf_escaped ("%i:%i" , duration/60 , duration%60); result = g_markup_printf_escaped ("%i:%i" , duration/60 , duration%60);
} }
return g_markup_printf_escaped ("<small>Duration:</small> %s", res); gchar *old_result = result;
result = g_markup_printf_escaped ("<small>Duration:</small> %s", old_result);
g_free(old_result);
return result;
} }
static const gchar* get_history_id_from_state (history_state_t state) static const gchar* get_history_id_from_state (history_state_t state)
......
...@@ -1058,6 +1058,7 @@ void calltree_add_history_entry (callable_obj_t *c, GtkTreeIter *parent) ...@@ -1058,6 +1058,7 @@ void calltree_add_history_entry (callable_obj_t *c, GtkTreeIter *parent)
date = get_formatted_start_timestamp (c->_time_start); date = get_formatted_start_timestamp (c->_time_start);
duration = get_call_duration (c); duration = get_call_duration (c);
gchar * full_duration = g_strconcat (date , duration , NULL); gchar * full_duration = g_strconcat (date , duration , NULL);
g_free (date);
g_free (duration); g_free (duration);
gchar * full_description = g_strconcat (description , full_duration, NULL); gchar * full_description = g_strconcat (description , full_duration, NULL);
g_free (description); g_free (description);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment