[vlmc-devel] VlmcLogger: Check asprintf return
Hugo Beauzée-Luyssen
git at videolan.org
Sat Mar 1 13:46:02 CET 2014
vlmc | branch: master | Hugo Beauzée-Luyssen <hugo at beauzee.fr> | Sat Mar 1 13:45:43 2014 +0100| [424cbdeab5dd8f6d40f282a1af17f45d12e03e37] | committer: Hugo Beauzée-Luyssen
VlmcLogger: Check asprintf return
> http://git.videolan.org/gitweb.cgi/vlmc.git/?a=commit;h=424cbdeab5dd8f6d40f282a1af17f45d12e03e37
---
src/Tools/VlmcLogger.cpp | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/Tools/VlmcLogger.cpp b/src/Tools/VlmcLogger.cpp
index 93e3e13..3c29307 100644
--- a/src/Tools/VlmcLogger.cpp
+++ b/src/Tools/VlmcLogger.cpp
@@ -183,8 +183,10 @@ VlmcLogger::backendLogHandler(void *data, Backend::IBackend::LogLevel logLevel,
{
VlmcLogger* self = reinterpret_cast<VlmcLogger*>( data );
char* newMsg = NULL;
- asprintf( &newMsg, "[%s] T #%p [Backend] %s", qPrintable( QTime::currentTime().toString( "hh:mm:ss.zzz" ) ),
- QThread::currentThreadId(), msg );
+ if ( asprintf( &newMsg, "[%s] T #%p [Backend] %s", qPrintable( QTime::currentTime().toString( "hh:mm:ss.zzz" ) ),
+ QThread::currentThreadId(), msg ) < 0 )
+ return ;
+
if ( self->m_logFile != NULL )
self->writeToFile( newMsg );
if ( logLevel < self->m_backendLogLevel )
More information about the Vlmc-devel
mailing list