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

* #7178: gnome: fixed memory leaks

Use g_strfreev on null terminated gchar **, not g_free. Otherwise you
don't free all the elements of the list.
parent 7d0df41e
No related branches found
No related tags found
No related merge requests found
...@@ -495,10 +495,9 @@ sflphone_on_hold() ...@@ -495,10 +495,9 @@ sflphone_on_hold()
WARN("Should not happen in sflphone_on_hold!"); WARN("Should not happen in sflphone_on_hold!");
break; break;
} }
} else if (selectedConf) { } else if (selectedConf)
dbus_hold_conference(selectedConf); dbus_hold_conference(selectedConf);
} }
}
void void
sflphone_off_hold() sflphone_off_hold()
...@@ -516,10 +515,9 @@ sflphone_off_hold() ...@@ -516,10 +515,9 @@ sflphone_off_hold()
WARN("Should not happen in sflphone_off_hold ()!"); WARN("Should not happen in sflphone_off_hold ()!");
break; break;
} }
} else if (selectedConf) { } else if (selectedConf)
dbus_unhold_conference(selectedConf); dbus_unhold_conference(selectedConf);
} }
}
void void
...@@ -541,7 +539,6 @@ sflphone_busy(callable_obj_t * c) ...@@ -541,7 +539,6 @@ sflphone_busy(callable_obj_t * c)
void void
sflphone_current(callable_obj_t * c) sflphone_current(callable_obj_t * c)
{ {
if (c->_state != CALL_STATE_HOLD) if (c->_state != CALL_STATE_HOLD)
time(&c->_time_start); time(&c->_time_start);
...@@ -1020,9 +1017,9 @@ void sflphone_fill_codec_list_per_account(account_t *account) ...@@ -1020,9 +1017,9 @@ void sflphone_fill_codec_list_per_account(account_t *account)
// Each account will have a copy of the system-wide capabilities // Each account will have a copy of the system-wide capabilities
codec_t *cpy = codec_create_new_from_caps(codec_list_get_by_payload((gconstpointer)(uintptr_t) payload, NULL)); codec_t *cpy = codec_create_new_from_caps(codec_list_get_by_payload((gconstpointer)(uintptr_t) payload, NULL));
if (cpy) { if (cpy)
codec_list_add(cpy, &codeclist); codec_list_add(cpy, &codeclist);
} else else
ERROR("SFLphone: Couldn't find codec"); ERROR("SFLphone: Couldn't find codec");
} }
...@@ -1047,7 +1044,7 @@ void sflphone_fill_call_list(void) ...@@ -1047,7 +1044,7 @@ void sflphone_fill_call_list(void)
{ {
gchar **list = dbus_get_call_list(); gchar **list = dbus_get_call_list();
for (gchar **calls = list; calls && *calls; calls++) { for (gchar **calls = list; calls && *calls; ++calls) {
gchar *callID = *calls; gchar *callID = *calls;
callable_obj_t *c = create_new_call_from_details(*calls, dbus_get_call_details(*calls)); callable_obj_t *c = create_new_call_from_details(*calls, dbus_get_call_details(*calls));
g_free(callID); g_free(callID);
...@@ -1056,7 +1053,7 @@ void sflphone_fill_call_list(void) ...@@ -1056,7 +1053,7 @@ void sflphone_fill_call_list(void)
calltree_add_call(current_calls_tab, c, NULL); calltree_add_call(current_calls_tab, c, NULL);
} }
g_free(list); g_strfreev(list);
} }
...@@ -1084,7 +1081,6 @@ void sflphone_fill_history(void) ...@@ -1084,7 +1081,6 @@ void sflphone_fill_history(void)
gchar **entries, **entries_orig; gchar **entries, **entries_orig;
callable_obj_t *history_call, *call; callable_obj_t *history_call, *call;
QueueElement *element; QueueElement *element;
guint i = 0, n = 0;
entries = entries_orig = dbus_get_history(); entries = entries_orig = dbus_get_history();
...@@ -1096,15 +1092,16 @@ void sflphone_fill_history(void) ...@@ -1096,15 +1092,16 @@ void sflphone_fill_history(void)
// create a conference entry // create a conference entry
conference_obj_t *history_conf = create_conference_history_entry_from_serialized(current_entry); conference_obj_t *history_conf = create_conference_history_entry_from_serialized(current_entry);
// verify if this conference has been already created yet // verify if this conference has been already created
conference_obj_t *conf = conferencelist_get(history_tab, history_conf->_confID); conference_obj_t *conf = conferencelist_get(history_tab, history_conf->_confID);
// if this conference hasn't been created yet, add it to the conference list // if this conference hasn't been created yet, add it to the conference list
if (!conf) if (!conf)
conferencelist_add(history_tab, history_conf); conferencelist_add(history_tab, history_conf);
else { else {
// if this conference was already created since one of the participant have already // if this conference was already created since one of the participants have already
// been unserialized, update the recordfile value // been unserialized, update the recordfile value
g_free(conf->_recordfile);
conf->_recordfile = g_strdup(history_conf->_recordfile); conf->_recordfile = g_strdup(history_conf->_recordfile);
} }
} else { } else {
...@@ -1114,7 +1111,7 @@ void sflphone_fill_history(void) ...@@ -1114,7 +1111,7 @@ void sflphone_fill_history(void)
// Add it and update the GUI // Add it and update the GUI
calllist_add_call(history_tab, history_call); calllist_add_call(history_tab, history_call);
if (history_call->_confID && g_strcmp0(history_call->_confID, "") != 0) { if (history_call->_confID && strlen(history_call->_confID) > 0) {
// process conference // process conference
conference_obj_t *conf = conferencelist_get(history_tab, history_call->_confID); conference_obj_t *conf = conferencelist_get(history_tab, history_call->_confID);
...@@ -1137,12 +1134,12 @@ void sflphone_fill_history(void) ...@@ -1137,12 +1134,12 @@ void sflphone_fill_history(void)
g_free(*entries++); g_free(*entries++);
} }
g_free(entries_orig); g_strfreev(entries_orig);
// fill the treeview with calls // fill the treeview with calls
n = calllist_get_size(history_tab); guint n = calllist_get_size(history_tab);
for (i = 0; i < n; i++) { for (guint i = 0; i < n; i++) {
element = calllist_get_nth(history_tab, i); element = calllist_get_nth(history_tab, i);
if (element->type == HIST_CALL) { if (element->type == HIST_CALL) {
...@@ -1154,7 +1151,7 @@ void sflphone_fill_history(void) ...@@ -1154,7 +1151,7 @@ void sflphone_fill_history(void)
// fill the treeview with conferences // fill the treeview with conferences
n = conferencelist_get_size(history_tab); n = conferencelist_get_size(history_tab);
for (i = 0; i < n; i++) { for (guint i = 0; i < n; i++) {
conference_obj_t *conf = conferencelist_get_nth(history_tab, i); conference_obj_t *conf = conferencelist_get_nth(history_tab, i);
if (!conf) if (!conf)
DEBUG("SFLphone: Error: Could not find conference"); DEBUG("SFLphone: Error: Could not find conference");
...@@ -1185,7 +1182,7 @@ void sflphone_save_history(void) ...@@ -1185,7 +1182,7 @@ void sflphone_save_history(void)
gint size = calllist_get_size(history_tab); gint size = calllist_get_size(history_tab);
for (gint i = 0; i < size; i++) { for (gint i = 0; i < size; ++i) {
QueueElement *current = calllist_get_nth(history_tab, i); QueueElement *current = calllist_get_nth(history_tab, i);
if (!current) { if (!current) {
...@@ -1212,7 +1209,7 @@ void sflphone_save_history(void) ...@@ -1212,7 +1209,7 @@ void sflphone_save_history(void)
size = conferencelist_get_size(history_tab); size = conferencelist_get_size(history_tab);
for (gint i = 0; i < size; i++) { for (gint i = 0; i < size; ++i) {
conference_obj_t *conf = conferencelist_get_nth(history_tab, i); conference_obj_t *conf = conferencelist_get_nth(history_tab, i);
if (!conf) { if (!conf) {
......
...@@ -243,7 +243,7 @@ update_actions() ...@@ -243,7 +243,7 @@ update_actions()
if (active_calltree_tab == current_calls_tab) if (active_calltree_tab == current_calls_tab)
gtk_toolbar_insert(GTK_TOOLBAR(toolbar_), GTK_TOOL_ITEM(hangUpWidget_), 1); gtk_toolbar_insert(GTK_TOOLBAR(toolbar_), GTK_TOOL_ITEM(hangUpWidget_), 1);
else if (active_calltree_tab == history_tab) { else if (active_calltree_tab == history_tab) {
if (selectedCall->_recordfile &&(g_strcmp0(selectedCall->_recordfile, "") != 0)) { if (selectedCall->_recordfile && strlen(selectedCall->_recordfile) > 0) {
if (selectedCall->_record_is_playing) if (selectedCall->_record_is_playing)
gtk_toolbar_insert(GTK_TOOLBAR(toolbar_), GTK_TOOL_ITEM(stopRecordWidget_), 3); gtk_toolbar_insert(GTK_TOOLBAR(toolbar_), GTK_TOOL_ITEM(stopRecordWidget_), 3);
else else
...@@ -353,7 +353,7 @@ update_actions() ...@@ -353,7 +353,7 @@ update_actions()
gtk_toolbar_insert(GTK_TOOLBAR(toolbar_), GTK_TOOL_ITEM(imToolbar_), pos); gtk_toolbar_insert(GTK_TOOLBAR(toolbar_), GTK_TOOL_ITEM(imToolbar_), pos);
} }
} else if (active_calltree_tab == history_tab) { } else if (active_calltree_tab == history_tab) {
if (selectedConf->_recordfile &&(g_strcmp0(selectedConf->_recordfile, "") != 0)) { if (selectedConf->_recordfile && strlen(selectedConf->_recordfile) > 0) {
if (selectedConf->_record_is_playing) if (selectedConf->_record_is_playing)
gtk_toolbar_insert(GTK_TOOLBAR(toolbar_), GTK_TOOL_ITEM(stopRecordWidget_), 3); gtk_toolbar_insert(GTK_TOOLBAR(toolbar_), GTK_TOOL_ITEM(stopRecordWidget_), 3);
else else
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment