]> git.sesse.net Git - mlt/commitdiff
Fix locale corruption.
authorj-b-m <jb@kdenlive.org>
Fri, 9 Sep 2011 03:02:22 +0000 (20:02 -0700)
committerDan Dennedy <dan@dennedy.org>
Fri, 9 Sep 2011 03:02:22 +0000 (20:02 -0700)
setlocale returns a pointer that is no longer valid after the intermediate
call to setlocale.

src/framework/mlt_property.c

index 5f751acfd51ac55b523706cdaffb9c91d648346a..52227bcd92fb4484f47d7b0527dd373a1fdece1e 100644 (file)
@@ -512,7 +512,7 @@ char *mlt_property_get_string_l( mlt_property self, locale_t locale )
                pthread_mutex_lock( &self->mutex );
 
                // Get the current locale
-               const char *orig_localename = setlocale( LC_NUMERIC, NULL );
+               char *orig_localename = strdup( setlocale( LC_NUMERIC, NULL ) );
 
                // Set the new locale
                setlocale( LC_NUMERIC, localename );
@@ -548,6 +548,7 @@ char *mlt_property_get_string_l( mlt_property self, locale_t locale )
                }
                // Restore the current locale
                setlocale( LC_NUMERIC, orig_localename );
+               free( orig_localename );
                pthread_mutex_unlock( &self->mutex );
        }