]> git.sesse.net Git - vlc/blobdiff - modules/meta_engine/taglib.cpp
Check malloc return value.
[vlc] / modules / meta_engine / taglib.cpp
index e6b288d50e3f2b479e5443d4a8d844d2363f525a..b125966f58cbe08e6eaf15437c982f2770534890 100644 (file)
@@ -299,12 +299,15 @@ static int ReadMeta( vlc_object_t *p_this )
                         * terminated string */
                     char *psz_ufid = (char*) malloc( 64 );
                     int j = 0;
-                    while( ( j < 63 ) &&
-                            ( j < p_ufid->identifier().size() ) )
-                        psz_ufid[j] = p_ufid->identifier()[j++];
-                    psz_ufid[j] = '\0';
-                    vlc_meta_SetTrackID( p_meta, psz_ufid );
-                    free( psz_ufid );
+                    if( psz_ufid )
+                    {
+                        while( ( j < 63 ) &&
+                               ( j < p_ufid->identifier().size() ) )
+                            psz_ufid[j] = p_ufid->identifier()[j++];
+                        psz_ufid[j] = '\0';
+                        vlc_meta_SetTrackID( p_meta, psz_ufid );
+                        free( psz_ufid );
+                    }
                 }
             }