[vlc-devel] [PATCH 08/12] vlc: vlc_meta_Delete: do nothing if argument is NULL
Filip Roséen
filip at videolabs.io
Mon Mar 14 11:08:59 CET 2016
---
include/vlc_meta.h | 7 +++++++
src/input/meta.c | 4 ++++
2 files changed, 11 insertions(+)
diff --git a/include/vlc_meta.h b/include/vlc_meta.h
index 381b211..caf7022 100644
--- a/include/vlc_meta.h
+++ b/include/vlc_meta.h
@@ -74,6 +74,13 @@ typedef enum vlc_meta_type_t
struct vlc_meta_t;
VLC_API vlc_meta_t * vlc_meta_New( void ) VLC_USED;
+/**
+ * Destroys a meta object
+ *
+ * If the argument passed to the function is NULL, the function does nothing.
+ *
+ * \param m pointer to the meta object to destroy
+ */
VLC_API void vlc_meta_Delete( vlc_meta_t *m );
VLC_API void vlc_meta_Set( vlc_meta_t *p_meta, vlc_meta_type_t meta_type, const char *psz_val );
VLC_API const char * vlc_meta_Get( const vlc_meta_t *p_meta, vlc_meta_type_t meta_type );
diff --git a/src/input/meta.c b/src/input/meta.c
index 8353a5e..7172b13 100644
--- a/src/input/meta.c
+++ b/src/input/meta.c
@@ -110,6 +110,10 @@ static void vlc_meta_FreeExtraKey( void *p_data, void *p_obj )
void vlc_meta_Delete( vlc_meta_t *m )
{
int i;
+
+ if( m == NULL )
+ return;
+
for( i = 0; i < VLC_META_TYPE_COUNT ; i++ )
free( m->ppsz_meta[i] );
vlc_dictionary_clear( &m->extra_tags, vlc_meta_FreeExtraKey, NULL );
--
2.7.3
More information about the vlc-devel
mailing list