From 93634c30c28b64bc0dbd898f04dd57804b10432f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Thu, 13 Sep 2007 08:42:55 +0000 Subject: [PATCH] gst/gstbuffer.c: Implement poisoning for GstBuffer if --enable-poisoning is specified. Original commit message from CVS: * gst/gstbuffer.c: (gst_buffer_finalize): Implement poisoning for GstBuffer if --enable-poisoning is specified. When finalizing a buffer the complete struct is filled with 0xff, thus making a use of the buffer after the final unref impossible. --- ChangeLog | 7 +++++++ gst/gstbuffer.c | 4 ++++ 2 files changed, 11 insertions(+) diff --git a/ChangeLog b/ChangeLog index 9b22d0cb32..84f8fe3548 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2007-09-13 Sebastian Dröge + + * gst/gstbuffer.c: (gst_buffer_finalize): + Implement poisoning for GstBuffer if --enable-poisoning is specified. + When finalizing a buffer the complete struct is filled with 0xff, + thus making a use of the buffer after the final unref impossible. + 2007-09-13 Sebastian Dröge * tests/check/libs/controller.c: (GST_START_TEST): diff --git a/gst/gstbuffer.c b/gst/gstbuffer.c index c553ac1034..e7db9eaaf3 100644 --- a/gst/gstbuffer.c +++ b/gst/gstbuffer.c @@ -192,6 +192,10 @@ gst_buffer_finalize (GstBuffer * buffer) g_free (buffer->malloc_data); gst_caps_replace (&GST_BUFFER_CAPS (buffer), NULL); + +#ifdef USE_POISONING + memset (buffer, 0xff, sizeof (GstBuffer)); +#endif } /**