diff --git a/tgp-structs.c b/tgp-structs.c index 3ec98f3..c1f3e50 100644 --- a/tgp-structs.c +++ b/tgp-structs.c @@ -105,8 +105,8 @@ void *connection_data_free (connection_data *conn) { tgp_g_queue_free_full (conn->pending_reads, pending_reads_free_cb); tgp_g_queue_free_full (conn->new_messages, message_text_free); - g_list_free_full (conn->used_images, used_image_free); - g_list_free_full (conn->transfers, tgp_xfer_send_data_free); + tgp_g_list_free_full (conn->used_images, used_image_free); + tgp_g_list_free_full (conn->transfers, tgp_xfer_send_data_free); tgl_free_all (conn->TLS); free (conn->TLS); diff --git a/tgp-utils.c b/tgp-utils.c index 8a979ab..e57eb32 100644 --- a/tgp-utils.c +++ b/tgp-utils.c @@ -93,3 +93,8 @@ void tgp_g_queue_free_full (GQueue *queue, GDestroyNotify free_func) { } g_queue_free (queue); } + +void tgp_g_list_free_full (GList *list, GDestroyNotify free_func) { + g_list_foreach (list, (GFunc)free_func, NULL); + g_list_free (list); +} diff --git a/tgp-utils.h b/tgp-utils.h index 21c3191..a44170f 100644 --- a/tgp-utils.h +++ b/tgp-utils.h @@ -46,5 +46,6 @@ char *format_img_full (int imgstore); int str_not_empty (const char *string); char *tgp_g_format_size (gint64 size); void tgp_g_queue_free_full (GQueue *queue, GDestroyNotify free_func); +void tgp_g_list_free_full (GList *list, GDestroyNotify free_func); #endif