From 942fc7f79e6de35db61f3a54840c72011ce1ce8b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Fri, 3 Aug 2018 13:16:21 +0300 Subject: [PATCH] gst: Add poisoning to more types --- gst/gstbufferlist.c | 9 ++++++++- gst/gstcaps.c | 5 +++++ gst/gstcontext.c | 4 ++++ gst/gstdatetime.c | 5 +++++ gst/gstevent.c | 3 +++ gst/gstmemory.c | 1 + gst/gstmessage.c | 3 +++ gst/gstpromise.c | 4 ++++ gst/gstquery.c | 3 +++ gst/gstsample.c | 3 +++ gst/gsttaglist.c | 4 ++++ gst/gsttoc.c | 8 ++++++++ gst/gsturi.c | 4 ++++ 13 files changed, 55 insertions(+), 1 deletion(-) diff --git a/gst/gstbufferlist.c b/gst/gstbufferlist.c index 21fed17c2f..2c1359769e 100644 --- a/gst/gstbufferlist.c +++ b/gst/gstbufferlist.c @@ -103,6 +103,7 @@ static void _gst_buffer_list_free (GstBufferList * list) { guint i, len; + gsize slice_size; GST_LOG ("free %p", list); @@ -117,7 +118,13 @@ _gst_buffer_list_free (GstBufferList * list) if (GST_BUFFER_LIST_IS_USING_DYNAMIC_ARRAY (list)) g_free (list->buffers); - g_slice_free1 (list->slice_size, list); + slice_size = list->slice_size; + +#ifdef USE_POISONING + memset (list, 0xff, slice_size); +#endif + + g_slice_free1 (slice_size, list); } static void diff --git a/gst/gstcaps.c b/gst/gstcaps.c index 8af0503ce3..01f8934be1 100644 --- a/gst/gstcaps.c +++ b/gst/gstcaps.c @@ -216,6 +216,11 @@ _gst_caps_free (GstCaps * caps) #ifdef DEBUG_REFCOUNT GST_CAT_TRACE (GST_CAT_CAPS, "freeing caps %p", caps); #endif + +#ifdef USE_POISONING + memset (caps, 0xff, sizeof (GstCapsImpl)); +#endif + g_slice_free1 (sizeof (GstCapsImpl), caps); } diff --git a/gst/gstcontext.c b/gst/gstcontext.c index 73cace4f33..c1bbe0a8be 100644 --- a/gst/gstcontext.c +++ b/gst/gstcontext.c @@ -108,6 +108,10 @@ _gst_context_free (GstContext * context) } g_free (context->context_type); +#ifdef USE_POISONING + memset (context, 0xff, sizeof (GstContext)); +#endif + g_slice_free1 (sizeof (GstContext), context); } diff --git a/gst/gstdatetime.c b/gst/gstdatetime.c index efd0460df3..cea0f708a0 100644 --- a/gst/gstdatetime.c +++ b/gst/gstdatetime.c @@ -922,6 +922,11 @@ static void gst_date_time_free (GstDateTime * datetime) { g_date_time_unref (datetime->datetime); + +#ifdef USE_POISONING + memset (datetime, 0xff, sizeof (GstDateTime)); +#endif + g_slice_free (GstDateTime, datetime); } diff --git a/gst/gstevent.c b/gst/gstevent.c index fae950c32d..0189f433b2 100644 --- a/gst/gstevent.c +++ b/gst/gstevent.c @@ -228,6 +228,9 @@ _gst_event_free (GstEvent * event) gst_structure_set_parent_refcount (s, NULL); gst_structure_free (s); } +#ifdef USE_POISONING + memset (event, 0xff, sizeof (GstEventImpl)); +#endif g_slice_free1 (sizeof (GstEventImpl), event); } diff --git a/gst/gstmemory.c b/gst/gstmemory.c index eead80ac46..a68aa47a94 100644 --- a/gst/gstmemory.c +++ b/gst/gstmemory.c @@ -95,6 +95,7 @@ _gst_memory_free (GstMemory * mem) allocator = mem->allocator; gst_allocator_free (allocator, mem); + gst_object_unref (allocator); } diff --git a/gst/gstmessage.c b/gst/gstmessage.c index ef0ca96fd7..25c47e18c8 100644 --- a/gst/gstmessage.c +++ b/gst/gstmessage.c @@ -217,6 +217,9 @@ _gst_message_free (GstMessage * message) gst_structure_set_parent_refcount (structure, NULL); gst_structure_free (structure); } +#ifdef USE_POISONING + memset (message, 0xff, sizeof (GstMessageImpl)); +#endif g_slice_free1 (sizeof (GstMessageImpl), message); } diff --git a/gst/gstpromise.c b/gst/gstpromise.c index 55f5149f72..e8e971a1f4 100644 --- a/gst/gstpromise.c +++ b/gst/gstpromise.c @@ -335,6 +335,10 @@ gst_promise_free (GstMiniObject * object) g_cond_clear (GST_PROMISE_COND (promise)); GST_LOG ("%p finalized", promise); +#ifdef USE_POISONING + memset (promise, 0xff, sizeof (GstPromiseImpl)); +#endif + g_free (promise); } diff --git a/gst/gstquery.c b/gst/gstquery.c index b6dba1a342..0ef77cce3c 100644 --- a/gst/gstquery.c +++ b/gst/gstquery.c @@ -195,6 +195,9 @@ _gst_query_free (GstQuery * query) gst_structure_set_parent_refcount (s, NULL); gst_structure_free (s); } +#ifdef USE_POISONING + memset (query, 0xff, sizeof (GstQueryImpl)); +#endif g_slice_free1 (sizeof (GstQueryImpl), query); } diff --git a/gst/gstsample.c b/gst/gstsample.c index b73461d52e..627ea07a66 100644 --- a/gst/gstsample.c +++ b/gst/gstsample.c @@ -101,6 +101,9 @@ _gst_sample_free (GstSample * sample) GST_MINI_OBJECT_CAST (sample)); gst_buffer_list_unref (sample->buffer_list); } +#ifdef USE_POISONING + memset (sample, 0xff, sizeof (GstSample)); +#endif g_slice_free1 (sizeof (GstSample), sample); } diff --git a/gst/gsttaglist.c b/gst/gsttaglist.c index 059c87e839..4845d90778 100644 --- a/gst/gsttaglist.c +++ b/gst/gsttaglist.c @@ -719,6 +719,10 @@ __gst_tag_list_free (GstTagList * list) gst_structure_free (GST_TAG_LIST_STRUCTURE (list)); +#ifdef USE_POISONING + memset (list, 0xff, sizeof (GstTagListImpl)); +#endif + g_slice_free1 (sizeof (GstTagListImpl), list); } diff --git a/gst/gsttoc.c b/gst/gsttoc.c index 7e62d5f3d1..fd6bd665eb 100644 --- a/gst/gsttoc.c +++ b/gst/gsttoc.c @@ -309,6 +309,10 @@ gst_toc_free (GstToc * toc) if (toc->tags != NULL) gst_tag_list_unref (toc->tags); +#ifdef USE_POISONING + memset (toc, 0xff, sizeof (GstToc)); +#endif + g_slice_free (GstToc, toc); } @@ -325,6 +329,10 @@ gst_toc_entry_free (GstTocEntry * entry) if (entry->tags != NULL) gst_tag_list_unref (entry->tags); +#ifdef USE_POISONING + memset (entry, 0xff, sizeof (GstTocEntry)); +#endif + g_slice_free (GstTocEntry, entry); } diff --git a/gst/gsturi.c b/gst/gsturi.c index 2a9c621136..4b1d47fc7b 100644 --- a/gst/gsturi.c +++ b/gst/gsturi.c @@ -1014,6 +1014,10 @@ _gst_uri_free (GstUri * uri) g_hash_table_unref (uri->query); g_free (uri->fragment); +#ifdef USE_POISONING + memset (uri, 0xff, sizeof (*uri)); +#endif + g_slice_free1 (sizeof (*uri), uri); }