From a44a9bf9f0a810070c7c0e3e33e5e2120853416e Mon Sep 17 00:00:00 2001 From: Jerzy Ptak Date: Thu, 5 Apr 2018 01:58:16 +0100 Subject: [PATCH] fixing memory leaks --- daemon/codec.c | 4 ++++ daemon/dtls.c | 7 +++++++ daemon/ssrc.c | 7 +++++-- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/daemon/codec.c b/daemon/codec.c index a6e5d90e3..89e9da8eb 100644 --- a/daemon/codec.c +++ b/daemon/codec.c @@ -380,6 +380,9 @@ next: } } + while (passthrough_handlers) { + passthrough_handlers = g_slist_delete_link(passthrough_handlers, passthrough_handlers); + } } @@ -742,6 +745,7 @@ static int handler_func_transcode(struct codec_handler *h, struct call_media *me if (packet_sequencer_insert(&ch->sequencer, &packet->p)) { // dupe mutex_unlock(&ch->lock); + obj_put(&ch->h); __transcode_packet_free(packet); ilog(LOG_DEBUG, "Ignoring duplicate RTP packet"); atomic64_inc(&mp->ssrc_in->duplicates); diff --git a/daemon/dtls.c b/daemon/dtls.c index 793f4abc2..f1fc09e6b 100644 --- a/daemon/dtls.c +++ b/daemon/dtls.c @@ -768,6 +768,13 @@ void dtls_shutdown(struct packet_stream *ps) { __DBG("dtls_shutdown"); + + if (ps->ice_dtls.init) { + if (ps->ice_dtls.connected && ps->ice_dtls.ssl) { + SSL_shutdown(ps->ice_dtls.ssl); + } + dtls_connection_cleanup(&ps->ice_dtls); + } for (GList *l = ps->sfds.head; l; l = l->next) { struct stream_fd *sfd = l->data; diff --git a/daemon/ssrc.c b/daemon/ssrc.c index 28310bce2..2bb108aae 100644 --- a/daemon/ssrc.c +++ b/daemon/ssrc.c @@ -272,6 +272,7 @@ found:; if (rtt <= 0 || rtt > 10000000) { ilog(LOG_DEBUG, "Invalid RTT - discarding"); + obj_put(&e->h); return 0; } @@ -321,13 +322,13 @@ void ssrc_receiver_report(struct call_media *m, const struct ssrc_receiver_repor // determine the clock rate for jitter values if (pt < 0) { ilog(LOG_DEBUG, "No payload type known for RTCP RR, discarding"); - goto out_nl; + goto out_nl_put; } const struct rtp_payload_type *rpt = rtp_payload_type(pt, m->codecs_send); if (!rpt) { ilog(LOG_INFO, "Invalid RTP payload type %i, discarding RTCP RR", pt); - goto out_nl; + goto out_nl_put; } unsigned int jitter = rpt->clock_rate ? (rr->jitter * 1000 / rpt->clock_rate) : rr->jitter; ilog(LOG_DEBUG, "Calculated jitter for %x is %u ms", rr->ssrc, jitter); @@ -374,6 +375,8 @@ void ssrc_receiver_report(struct call_media *m, const struct ssrc_receiver_repor out_ul_oe: mutex_unlock(&other_e->h.lock); + goto out_nl_put; +out_nl_put: obj_put(&other_e->h); goto out_nl; out_nl: