[vlc-devel] [PATCH 09/12] vlc: filter_chain_Delete: do nothing if argument is NULL

Filip Roséen filip at videolabs.io
Mon Mar 14 11:09:00 CET 2016


---
 include/vlc_filter.h    | 2 ++
 src/misc/filter_chain.c | 3 +++
 2 files changed, 5 insertions(+)

diff --git a/include/vlc_filter.h b/include/vlc_filter.h
index fafe12c..56a075c 100644
--- a/include/vlc_filter.h
+++ b/include/vlc_filter.h
@@ -302,6 +302,8 @@ VLC_USED;
  * Delete filter chain will delete all filters in the chain and free all
  * allocated data. The pointer to the filter chain is then no longer valid.
  *
+ * If the argument passed to the function is NULL, the function does nothing.
+ *
  * \param p_chain pointer to filter chain
  */
 VLC_API void filter_chain_Delete( filter_chain_t * );
diff --git a/src/misc/filter_chain.c b/src/misc/filter_chain.c
index 3f18f64..e338067 100644
--- a/src/misc/filter_chain.c
+++ b/src/misc/filter_chain.c
@@ -147,6 +147,9 @@ filter_chain_t *filter_chain_NewVideo( vlc_object_t *obj, bool allow_change,
  */
 void filter_chain_Delete( filter_chain_t *p_chain )
 {
+    if( p_chain == NULL )
+        return;
+
     while( p_chain->first != NULL )
         filter_chain_DeleteFilter( p_chain, &p_chain->first->filter );
 
-- 
2.7.3



More information about the vlc-devel mailing list