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

git version control git at videolan.org
Fri Jun 26 14:42:06 CEST 2009


vlc | branch: 1.0-bugfix | Rémi Duraffort <ivoire at videolan.org> | Fri Jun 26 09:27:23 2009 +0200| [a90a8151f8a28234fe2b03bc149fdd538fff1f24] | committer: Rémi Duraffort 

DynamicOverlay: fix crash (invalid free).
The string given in a callback must be copied.
(cherry picked from commit 1446509e7b3d2226a2fc054399114be8e695c506)

Signed-off-by: Rémi Duraffort <ivoire at videolan.org>

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

 .../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 ec5da96..e81e925 100644
--- a/modules/video_filter/dynamicoverlay/dynamicoverlay.c
+++ b/modules/video_filter/dynamicoverlay/dynamicoverlay.c
@@ -387,9 +387,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