[vlc-devel] [PATCH 02/12] vlc: demux_Delete: do nothing if pointer is NULL

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


---
 include/vlc_demux.h | 9 ++++++++-
 src/input/demux.c   | 3 +++
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/include/vlc_demux.h b/include/vlc_demux.h
index 45f5416..3d63b5f 100644
--- a/include/vlc_demux.h
+++ b/include/vlc_demux.h
@@ -288,7 +288,14 @@ enum demux_query_e
 VLC_API demux_t *demux_New( vlc_object_t *p_obj, const char *psz_name,
                             const char *psz_path, stream_t *s, es_out_t *out );
 
-VLC_API void demux_Delete( demux_t * );
+/**
+ * Destroys a demuxer
+ *
+ * If the pointer passed to the function is NULL, the function does nothing.
+ *
+ * \param p_demux pointer to the demux to delete
+ **/
+VLC_API void demux_Delete( demux_t * p_demux );
 
 
 VLC_API int demux_vaControlHelper( stream_t *, int64_t i_start, int64_t i_end,
diff --git a/src/input/demux.c b/src/input/demux.c
index 303c0b8..1a607f8 100644
--- a/src/input/demux.c
+++ b/src/input/demux.c
@@ -342,6 +342,9 @@ void demux_Delete( demux_t *p_demux )
 {
     stream_t *s;
 
+    if( p_demux == NULL )
+        return;
+
     module_unneed( p_demux, p_demux->p_module );
     free( p_demux->psz_file );
     free( p_demux->psz_location );
-- 
2.7.3



More information about the vlc-devel mailing list