mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-23 08:46:40 +00:00
dtls: Fix memory leak
Keys were not correctly released when it was get as a property nor when a second key was received https://bugzilla.gnome.org/show_bug.cgi?id=749380
This commit is contained in:
parent
c6abd1632f
commit
d625770a18
4 changed files with 16 additions and 0 deletions
|
@ -404,6 +404,12 @@ on_key_received (GstDtlsConnection * connection, gpointer key, guint cipher,
|
|||
self->srtp_auth = auth;
|
||||
|
||||
key_dup = g_memdup (key, GST_DTLS_SRTP_MASTER_KEY_LENGTH);
|
||||
|
||||
if (self->decoder_key) {
|
||||
gst_buffer_unref (self->decoder_key);
|
||||
self->decoder_key = NULL;
|
||||
}
|
||||
|
||||
self->decoder_key =
|
||||
gst_buffer_new_wrapped (key_dup, GST_DTLS_SRTP_MASTER_KEY_LENGTH);
|
||||
|
||||
|
|
|
@ -509,6 +509,12 @@ on_key_received (GstDtlsConnection * connection, gpointer key, guint cipher,
|
|||
self->srtp_auth = auth;
|
||||
|
||||
key_dup = g_memdup (key, GST_DTLS_SRTP_MASTER_KEY_LENGTH);
|
||||
|
||||
if (self->encoder_key) {
|
||||
gst_buffer_unref (self->encoder_key);
|
||||
self->encoder_key = NULL;
|
||||
}
|
||||
|
||||
self->encoder_key =
|
||||
gst_buffer_new_wrapped (key_dup, GST_DTLS_SRTP_MASTER_KEY_LENGTH);
|
||||
|
||||
|
|
|
@ -381,6 +381,8 @@ on_decoder_request_key (GstElement * srtp_decoder,
|
|||
break;
|
||||
}
|
||||
|
||||
gst_buffer_unref (key_buffer);
|
||||
|
||||
return key_caps;
|
||||
} else {
|
||||
GST_WARNING_OBJECT (bin, "no srtp key available yet");
|
||||
|
|
|
@ -399,6 +399,8 @@ on_key_received (GObject * encoder, GstDtlsSrtpEnc * self)
|
|||
"rtp-auth", auth,
|
||||
"rtcp-auth", auth, "key", buffer, "random-key", FALSE, NULL);
|
||||
|
||||
gst_buffer_unref (buffer);
|
||||
|
||||
g_signal_emit (self, signals[SIGNAL_ON_KEY_SET], 0);
|
||||
} else {
|
||||
GST_DEBUG_OBJECT (self,
|
||||
|
|
Loading…
Reference in a new issue