[vlc-devel] [PATCH 04/12] vlc: stream_Delete: do nothing if pointer is NULL

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


---
 include/vlc_stream.h | 7 +++++++
 src/input/stream.c   | 3 +++
 2 files changed, 10 insertions(+)

diff --git a/include/vlc_stream.h b/include/vlc_stream.h
index d783487..ffccdfb 100644
--- a/include/vlc_stream.h
+++ b/include/vlc_stream.h
@@ -153,6 +153,13 @@ VLC_API uint64_t stream_Tell(const stream_t *) VLC_USED;
 VLC_API int stream_Seek(stream_t *, uint64_t offset) VLC_USED;
 
 VLC_API int stream_vaControl( stream_t *s, int i_query, va_list args );
+/**
+ * Destroys a stream
+ *
+ * If the pointer passed to the function is NULL, the function does nothing.
+ *
+ * \param s pointer to the stream to destroy
+ */
 VLC_API void stream_Delete( stream_t *s );
 VLC_API int stream_Control( stream_t *s, int i_query, ... );
 VLC_API block_t * stream_Block( stream_t *s, size_t );
diff --git a/src/input/stream.c b/src/input/stream.c
index b84fd13..0b178da 100644
--- a/src/input/stream.c
+++ b/src/input/stream.c
@@ -117,6 +117,9 @@ void stream_Delete(stream_t *s)
 {
     stream_priv_t *priv = (stream_priv_t *)s;
 
+    if( s == NULL )
+        return;
+
     priv->destroy(s);
     stream_CommonDelete(s);
 }
-- 
2.7.3



More information about the vlc-devel mailing list