DynamicOverlay: fix crash (invalid free).
authorRémi Duraffort <ivoire@videolan.org>
Fri, 26 Jun 2009 07:27:23 +0000 (09:27 +0200)
committerRémi Duraffort <ivoire@videolan.org>
Fri, 26 Jun 2009 07:27:23 +0000 (09:27 +0200)
The string given in a callback must be copied.

modules/video_filter/dynamicoverlay/dynamicoverlay.c

index c4301c1..6ab22e6 100644 (file)
@@ -385,9 +385,15 @@ static int AdjustCallback( vlc_object_t *p_this, char const *psz_var,
     VLC_UNUSED(p_this); VLC_UNUSED(oldval);
 
     if( !strncmp( psz_var, "overlay-input", 13 ) )
-        p_sys->psz_inputfile = newval.psz_string;
+    {
+        free( p_sys->psz_inputfile );
+        p_sys->psz_inputfile = strdup( newval.psz_string );
+    }
     else if( !strncmp( psz_var, "overlay-output", 14 ) )
-        p_sys->psz_outputfile = newval.psz_string;
+    {
+        free( p_sys->psz_outputfile );
+        p_sys->psz_outputfile = strdup( newval.psz_string );
+    }
 
     return VLC_EGENERIC;
 }