[vlc-devel] [PATCH 11/12] vlc: xml_ReaderDelete: do nothing if argument is NULL

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


---
 include/vlc_xml.h | 7 +++++++
 src/misc/xml.c    | 3 +++
 2 files changed, 10 insertions(+)

diff --git a/include/vlc_xml.h b/include/vlc_xml.h
index 3c890a3..0906fe0 100644
--- a/include/vlc_xml.h
+++ b/include/vlc_xml.h
@@ -86,6 +86,13 @@ struct xml_reader_t
 
 VLC_API xml_reader_t * xml_ReaderCreate(vlc_object_t *, stream_t *) VLC_USED;
 #define xml_ReaderCreate( a, s ) xml_ReaderCreate(VLC_OBJECT(a), s)
+/**
+ * Destroys an xml reader instance
+ *
+ * If the argument passed to the function is NULL, the function does nothing.
+ *
+ * \param p_reader pointer to the xml reader to destroy.
+ **/
 VLC_API void xml_ReaderDelete(xml_reader_t *);
 VLC_API xml_reader_t * xml_ReaderReset(xml_reader_t *, stream_t *) VLC_USED;
 
diff --git a/src/misc/xml.c b/src/misc/xml.c
index f22d16d..4787374 100644
--- a/src/misc/xml.c
+++ b/src/misc/xml.c
@@ -97,6 +97,9 @@ xml_reader_t *xml_ReaderCreate(vlc_object_t *obj, stream_t *stream)
  */
 void xml_ReaderDelete(xml_reader_t *reader)
 {
+    if( reader == NULL )
+        return;
+
     if (reader->p_stream)
         module_stop(reader, reader->p_module);
     vlc_object_release(reader);
-- 
2.7.3



More information about the vlc-devel mailing list