[vlc-devel] commit: DynamicOverlay: fix crash (invalid free). ( Rémi Duraffort )

git version control git at videolan.org
Fri Jun 26 09:30:17 CEST 2009


vlc | branch: master | Rémi Duraffort <ivoire at videolan.org> | Fri Jun 26 09:27:23 2009 +0200| [1446509e7b3d2226a2fc054399114be8e695c506] | committer: Rémi Duraffort 

DynamicOverlay: fix crash (invalid free).
The string given in a callback must be copied.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=1446509e7b3d2226a2fc054399114be8e695c506
---

 .../video_filter/dynamicoverlay/dynamicoverlay.c   |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/modules/video_filter/dynamicoverlay/dynamicoverlay.c b/modules/video_filter/dynamicoverlay/dynamicoverlay.c
index c4301c1..6ab22e6 100644
--- a/modules/video_filter/dynamicoverlay/dynamicoverlay.c
+++ b/modules/video_filter/dynamicoverlay/dynamicoverlay.c
@@ -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;
 }




More information about the vlc-devel mailing list