fix a few memory leaks

This commit is contained in:
Florian Stinglmayr 2019-07-08 15:15:29 +02:00
parent 623649dd86
commit 8718ef85a0
3 changed files with 6 additions and 4 deletions

View File

@ -296,7 +296,7 @@ void dc_account_set_friends(dc_account_t a, dc_account_t *friends, size_t len)
g_ptr_array_remove_range(a->friends, 0, a->friends->len); g_ptr_array_remove_range(a->friends, 0, a->friends->len);
for (i = 0; i < len; i++) { for (i = 0; i < len; i++) {
g_ptr_array_add(a->friends, friends[i]); g_ptr_array_add(a->friends, dc_ref(friends[i]));
} }
} }

View File

@ -53,7 +53,9 @@ bool dc_api_get_friends(dc_api_t api, dc_account_t login)
cleanup: cleanup:
g_ptr_array_free(f, FALSE); if (f != NULL) {
g_ptr_array_unref(f);
}
json_decref(reply); json_decref(reply);
reply = NULL; reply = NULL;

View File

@ -57,8 +57,8 @@ bool ncdc_cmd_msg(ncdc_mainwindow_t n, size_t ac, wchar_t **av)
v = ncdc_textview_new(); v = ncdc_textview_new();
goto_if_true(v == NULL, cleanup); goto_if_true(v == NULL, cleanup);
ncdc_textview_set_account(v, dc_ref(current_account)); ncdc_textview_set_account(v, current_account);
ncdc_textview_set_channel(v, dc_ref(c)); ncdc_textview_set_channel(v, c);
g_ptr_array_add(ncdc_mainwindow_views(n), dc_ref(v)); g_ptr_array_add(ncdc_mainwindow_views(n), dc_ref(v));
ncdc_mainwindow_switchview(n, ncdc_mainwindow_views(n)->len-1); ncdc_mainwindow_switchview(n, ncdc_mainwindow_views(n)->len-1);