From 9b29e45ea43776a23486f2fbc2c7408873005df2 Mon Sep 17 00:00:00 2001 From: ehouse Date: Mon, 29 Jun 2009 12:58:30 +0000 Subject: [PATCH] plug valgrind-found leak; prefer localtime_r. --- xwords4/relay/crefmgr.cpp | 6 ++++++ xwords4/relay/xwrelay.cpp | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/xwords4/relay/crefmgr.cpp b/xwords4/relay/crefmgr.cpp index 1daebcd45..592f6ed18 100644 --- a/xwords4/relay/crefmgr.cpp +++ b/xwords4/relay/crefmgr.cpp @@ -70,6 +70,12 @@ CRefMgr::~CRefMgr() pthread_mutex_destroy( &m_guard ); pthread_rwlock_destroy( &m_cookieMapRWLock ); + SocketMap::iterator iter; + for ( iter = m_SocketStuff.begin(); iter != m_SocketStuff.end(); ++iter ) { + SocketStuff* stuff = iter->second; + delete stuff; + } + s_instance = NULL; } diff --git a/xwords4/relay/xwrelay.cpp b/xwords4/relay/xwrelay.cpp index fa8447374..c774eef3b 100644 --- a/xwords4/relay/xwrelay.cpp +++ b/xwords4/relay/xwrelay.cpp @@ -107,7 +107,8 @@ logf( XW_LogLevel level, const char* format, ... ) } gettimeofday( &tv, NULL ); - timp = localtime( &tv.tv_sec ); + struct tm result; + timp = localtime_r( &tv.tv_sec, &result ); pthread_t me = pthread_self();