diff --git a/daemon/call.c b/daemon/call.c index 791869cde..0063743fe 100644 --- a/daemon/call.c +++ b/daemon/call.c @@ -5069,7 +5069,7 @@ static void __call_cleanup(call_t *c) { media_player_put(&ml->rec_player); if (ml->tone_freqs) g_array_free(ml->tone_freqs, true); - obj_release_o(ml->janus_session); + obj_release(ml->janus_session); } while (c->stream_fds.head) { diff --git a/daemon/codec.c b/daemon/codec.c index 240ea9dcc..41043d7be 100644 --- a/daemon/codec.c +++ b/daemon/codec.c @@ -2092,7 +2092,7 @@ void mqtt_timer_start(struct mqtt_timer **mqtp, call_t *call, struct call_media static void codec_timer_stop(struct codec_timer **ctp) { if (!ctp) return; - obj_release_o(*ctp); + obj_release(*ctp); } // master lock held in W void rtcp_timer_stop(struct rtcp_timer **rtp) { diff --git a/lib/obj.h b/lib/obj.h index 6f8d6ebbf..27fe96e4c 100644 --- a/lib/obj.h +++ b/lib/obj.h @@ -109,8 +109,15 @@ INLINE void __obj_put(struct obj *o); #define obj_alloc(t,f) obj_alloc_full(t, f, g_malloc, (void (*)(t *)) g_free) #define obj_alloc0(t,f) obj_alloc_full(t, f, g_malloc0, (void (*)(t *)) g_free) -#define obj_release_o(op) do { if (op) obj_put_o((struct obj *) op); op = NULL; } while (0) -#define obj_release(op) do { if (op) obj_put(op); op = NULL; } while (0) +INLINE void __obj_release(struct obj **o) { + if (!*o) + return; + obj_put_o(*o); + *o = NULL; +} + +#define obj_release_o(op) __obj_release(&(op)) +#define obj_release(op) __obj_release((struct obj **) &(op)) INLINE void obj_put_gen(struct obj *o) { obj_put_o(o);