]> git.sesse.net Git - vlc/blobdiff - modules/video_output/msw/events.c
Check malloc return value when needed and don't print an error when such error happend.
[vlc] / modules / video_output / msw / events.c
index 2245bd6de18572312f20a4bdafd1186640475956..f37d9520be4b8db5b30c7375b7d23fdae58356d4 100644 (file)
@@ -343,9 +343,12 @@ void EventThread( event_thread_t *p_event )
 #ifdef UNICODE
             {
                 wchar_t *psz_title = malloc( strlen(val.psz_string) * 2 + 2 );
-                mbstowcs( psz_title, val.psz_string, strlen(val.psz_string)*2);
-                psz_title[strlen(val.psz_string)] = 0;
-                free( val.psz_string ); val.psz_string = (char *)psz_title;
+                if( psz_title )
+                {
+                    mbstowcs( psz_title, val.psz_string, strlen(val.psz_string)*2);
+                    psz_title[strlen(val.psz_string)] = 0;
+                    free( val.psz_string ); val.psz_string = (char *)psz_title;
+                }
             }
 #endif