From ce6c789e1000f61f9f50a3e39955f6f6a02cc7ca Mon Sep 17 00:00:00 2001 From: Mikko Rapeli Date: Wed, 25 Jul 2012 20:43:44 +0200 Subject: [PATCH] mlt_property_get_time(): get mutex before accessing self->types Fixes Coverity CID 709356: Data race condition (MISSING_LOCK) Accessing variable "self->types" (mlt_property_s.types) requires the mlt_property_s.mutex lock. 871 self->types |= mlt_prop_string; --- src/framework/mlt_property.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/framework/mlt_property.c b/src/framework/mlt_property.c index 7a518ff4..4d5f57c7 100644 --- a/src/framework/mlt_property.c +++ b/src/framework/mlt_property.c @@ -864,6 +864,11 @@ char *mlt_property_get_time( mlt_property self, mlt_time_format format, double f // Set the new locale setlocale( LC_NUMERIC, localename ); } + else + { + // Make sure we have a lock before accessing self->types + pthread_mutex_lock( &self->mutex ); + } // Convert number to string if ( self->types & mlt_prop_int ) @@ -910,6 +915,11 @@ char *mlt_property_get_time( mlt_property self, mlt_time_format format, double f free( orig_localename ); pthread_mutex_unlock( &self->mutex ); } + else + { + // Make sure we have a lock before accessing self->types + pthread_mutex_unlock( &self->mutex ); + } // Return the string (may be NULL) return self->prop_string; -- 2.39.2