srtp: zero out session member on dealloc

Fixes a user-after-free retrieving stats from _get_property()
This commit is contained in:
Matthew Waters 2017-08-24 18:00:41 +10:00
parent 63dd27a785
commit 029e01743f
2 changed files with 6 additions and 2 deletions

View file

@ -777,8 +777,10 @@ gst_srtp_dec_clear_streams (GstSrtpDec * filter)
GST_OBJECT_LOCK (filter);
if (!filter->first_session)
if (!filter->first_session) {
srtp_dealloc (filter->session);
filter->session = NULL;
}
if (filter->streams)
nb = g_hash_table_foreach_remove (filter->streams, remove_yes, NULL);

View file

@ -447,8 +447,10 @@ gst_srtp_enc_create_session (GstSrtpEnc * filter)
static void
gst_srtp_enc_reset_no_lock (GstSrtpEnc * filter)
{
if (!filter->first_session)
if (!filter->first_session) {
srtp_dealloc (filter->session);
filter->session = NULL;
}
filter->first_session = TRUE;
filter->key_changed = FALSE;