diff --git a/daemon/call.c b/daemon/call.c index c66bce7d4..62250fa90 100644 --- a/daemon/call.c +++ b/daemon/call.c @@ -5036,8 +5036,6 @@ void call_media_free(struct call_media **mdp) { t_hash_table_destroy(md->extmap_ht); t_queue_clear_full(&md->extmap, rtp_extension_free); t_hash_table_destroy_ptr(&md->pt_media); - g_free(md); - *mdp = NULL; } void __monologue_free(struct call_monologue *m) { @@ -5052,7 +5050,6 @@ void __monologue_free(struct call_monologue *m) { t_queue_clear_full(&m->all_attributes, sdp_attr_free); t_queue_clear(&m->tag_aliases); t_queue_clear(&m->groups_other); - g_free(m); } static void __call_free(call_t *c) { @@ -5080,7 +5077,6 @@ static void __call_free(call_t *c) { em = t_queue_pop_head(&c->endpoint_maps); t_queue_clear_full(&em->intf_sfds, free_sfd_intf_list); - g_free(em); } t_hash_table_destroy(c->tags); @@ -5095,7 +5091,6 @@ static void __call_free(call_t *c) { t_hash_table_destroy(ps->rtp_stats); bufferpool_unref(ps->stats_in); bufferpool_unref(ps->stats_out); - g_free(ps); } memory_arena_free(&c->buffer); diff --git a/daemon/media_socket.c b/daemon/media_socket.c index 165970d72..1383c94b5 100644 --- a/daemon/media_socket.c +++ b/daemon/media_socket.c @@ -4034,7 +4034,6 @@ void interfaces_free(void) { while ((ifc = t_queue_pop_head(&all_local_interfaces))) { free(ifc->ice_foundation.s); bufferpool_unref(ifc->stats); - g_free(ifc); } t_hash_table_destroy(__logical_intf_name_family_hash); diff --git a/lib/helpers.h b/lib/helpers.h index 036e7fdd3..e57b7d469 100644 --- a/lib/helpers.h +++ b/lib/helpers.h @@ -258,7 +258,7 @@ void thread_create_looper(enum thread_looper_action (*f)(void), const char *sche /*** ALLOC WITH UNIQUE ID HELPERS ***/ #define uid_alloc(q) ({ \ - __typeof__((q)->__t) __ret = g_new0(__typeof__(*(q)->__t), 1); \ + __typeof__((q)->__t) __ret = memory_arena_alloc0(__typeof__(*(q)->__t)); \ __ret->unique_id = (q)->length; \ t_queue_push_tail(q, __ret); \ __ret; \ diff --git a/t/test-transcode.c b/t/test-transcode.c index 3fac81ac5..49fbab8dc 100644 --- a/t/test-transcode.c +++ b/t/test-transcode.c @@ -78,7 +78,7 @@ static void __init(void) { flags.codec_set = str_case_value_ht_new(); } static struct packet_stream *ps_new(struct call_media *m) { - struct packet_stream *ps = malloc(sizeof(*ps)); + struct packet_stream *ps = memory_arena_alloc(struct packet_stream); assert(ps != NULL); memset(ps, 0, sizeof(*ps)); ps->endpoint.port = 12345; @@ -383,11 +383,10 @@ static void __packet_seq_ts(const char *file, int line, struct call_media *media static void end(void) { g_hash_table_destroy(rtp_ts_ht); g_hash_table_destroy(rtp_seq_ht); - t_queue_clear_full(&media_A->streams, (void (*)(struct packet_stream *)) free); - t_queue_clear_full(&media_B->streams, (void (*)(struct packet_stream *)) free); + t_queue_clear(&media_A->streams); + t_queue_clear(&media_B->streams); call_media_free(&media_A); call_media_free(&media_B); - bencode_buffer_free(&call.buffer); t_hash_table_destroy(call.tags); t_queue_clear(&call.medias); if (ml_A) @@ -395,6 +394,7 @@ static void end(void) { if (ml_B) __monologue_free(ml_B); __cleanup(); + bencode_buffer_free(&call.buffer); call_memory_arena_release(); printf("\n"); }