[vlc-devel] commit: variables: fix a potential crash/double free. ( Rémi Duraffort )

git version control git at videolan.org
Wed May 20 18:53:58 CEST 2009


vlc | branch: master | Rémi Duraffort <ivoire at videolan.org> | Tue May 19 23:33:00 2009 +0200| [9c24e1931faef97958eeb3287d0de778d4d07c89] | committer: Rémi Duraffort 

variables: fix a potential crash/double free.
Indeed, giving a NULL to var_Change(VLC_VAR_SETSTRING) will lead to a crash the
next time this variable is used.

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

 src/misc/variables.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/src/misc/variables.c b/src/misc/variables.c
index 1242431..f8bf3d8 100644
--- a/src/misc/variables.c
+++ b/src/misc/variables.c
@@ -623,6 +623,8 @@ int __var_Change( vlc_object_t *p_this, const char *psz_name,
             free( p_var->psz_text );
             if( p_val && p_val->psz_string )
                 p_var->psz_text = strdup( p_val->psz_string );
+            else
+                p_val->psz_text = NULL;
             break;
         case VLC_VAR_GETTEXT:
             p_val->psz_string = NULL;




More information about the vlc-devel mailing list