[vlc-devel] [PATCH 05/12] vlc: update_Delete: do nothing if argument is NULL

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


---
 include/vlc_update.h | 7 +++++++
 src/misc/update.c    | 5 ++++-
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/include/vlc_update.h b/include/vlc_update.h
index df74405..eeb1e70 100644
--- a/include/vlc_update.h
+++ b/include/vlc_update.h
@@ -55,6 +55,13 @@ typedef struct update_release_t update_release_t;
 
 VLC_API update_t * update_New( vlc_object_t * );
 #define update_New( a ) update_New( VLC_OBJECT( a ) )
+/**
+ * Destroys an update object
+ *
+ * If the pointer passed to the function is NULL, the function does nothing.
+ *
+ * \param p_update pointer to the update object to destroy
+ */
 VLC_API void update_Delete( update_t * );
 VLC_API void update_Check( update_t *, void (*callback)( void*, bool ), void * );
 VLC_API bool update_NeedUpgrade( update_t * );
diff --git a/src/misc/update.c b/src/misc/update.c
index 414b895..999c9e7 100644
--- a/src/misc/update.c
+++ b/src/misc/update.c
@@ -130,12 +130,15 @@ update_t *update_New( vlc_object_t *p_this )
 /**
  * Delete an update_t struct
  *
+ * If the pointer passed to the function is NULL, the function does nothing.
+ *
  * \param p_update update_t* pointer
  * \return nothing
  */
 void update_Delete( update_t *p_update )
 {
-    assert( p_update );
+    if( p_update == NULL )
+        return;
 
     if( p_update->p_check )
     {
-- 
2.7.3



More information about the vlc-devel mailing list