[vlc-devel] [PATCH 07/12] vlc: xml_Delete: do nothing if the argument is NULL

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


---
 include/vlc_xml.h | 9 ++++++++-
 src/misc/xml.c    | 3 +++
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/include/vlc_xml.h b/include/vlc_xml.h
index 661e76d..3c890a3 100644
--- a/include/vlc_xml.h
+++ b/include/vlc_xml.h
@@ -48,7 +48,14 @@ struct xml_t
 
 VLC_API xml_t * xml_Create( vlc_object_t * ) VLC_USED;
 #define xml_Create( a ) xml_Create( VLC_OBJECT(a) )
-VLC_API void xml_Delete( xml_t * );
+/**
+ * Destroys a xml instance
+ *
+ * If the argument passed to the function is NULL, the function does nothing.
+ *
+ * \param p_xml pointer to the xml instance to destroy
+ */
+VLC_API void xml_Delete( xml_t *p_xml );
 
 static inline void xml_CatalogLoad( xml_t *xml, const char *catalog )
 {
diff --git a/src/misc/xml.c b/src/misc/xml.c
index e145a5f..f22d16d 100644
--- a/src/misc/xml.c
+++ b/src/misc/xml.c
@@ -58,6 +58,9 @@ xml_t *xml_Create( vlc_object_t *p_this )
  *****************************************************************************/
 void xml_Delete( xml_t *p_xml )
 {
+    if( p_xml == NULL )
+        return;
+
     module_unneed( p_xml, p_xml->p_module );
     vlc_object_release( p_xml );
 }
-- 
2.7.3



More information about the vlc-devel mailing list