[vlc-devel] [PATCH 06/12] vlc: vlm_Delete: do nothing if argument is NULL

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


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

diff --git a/include/vlc_vlm.h b/include/vlc_vlm.h
index 88d4437..81a2a7c 100644
--- a/include/vlc_vlm.h
+++ b/include/vlc_vlm.h
@@ -185,7 +185,14 @@ extern "C" {
 
 VLC_API vlm_t * vlm_New( vlc_object_t * );
 #define vlm_New( a ) vlm_New( VLC_OBJECT(a) )
-VLC_API void vlm_Delete( vlm_t * );
+/**
+ * Destroys a vlm instance
+ *
+ * If the pointer passed to the function is NULL, the function does nothing.
+ *
+ * \param p_vlm pointer to the vlm instance to destroy
+ */
+VLC_API void vlm_Delete( vlm_t * p_vlm );
 VLC_API int vlm_ExecuteCommand( vlm_t *, const char *, vlm_message_t ** );
 VLC_API int vlm_Control( vlm_t *p_vlm, int i_query, ... );
 
diff --git a/src/input/vlm.c b/src/input/vlm.c
index 0854dd6..0720b01 100644
--- a/src/input/vlm.c
+++ b/src/input/vlm.c
@@ -198,6 +198,9 @@ vlm_t *vlm_New ( vlc_object_t *p_this )
  *****************************************************************************/
 void vlm_Delete( vlm_t *p_vlm )
 {
+    if( p_vlm == NULL )
+        return;
+
     /* vlm_Delete() is serialized against itself, and against vlm_New().
      * This mutex protects libvlc_priv->p_vlm and p_vlm->users. */
     vlc_mutex_lock( &vlm_mutex );
-- 
2.7.3



More information about the vlc-devel mailing list