Fix errors/warnings reported by valgrind

This commit is contained in:
sfan5 2014-07-06 16:17:46 +02:00
parent 6bd15247f9
commit eadde1e741
4 changed files with 32 additions and 32 deletions

@ -561,6 +561,7 @@ Channel::Channel() :
next_outgoing_split_seqnum(SEQNUM_INITIAL), next_outgoing_split_seqnum(SEQNUM_INITIAL),
current_packet_loss(0), current_packet_loss(0),
current_packet_too_late(0), current_packet_too_late(0),
current_packet_successfull(0),
packet_loss_counter(0), packet_loss_counter(0),
current_bytes_transfered(0), current_bytes_transfered(0),
current_bytes_received(0), current_bytes_received(0),
@ -3114,4 +3115,3 @@ std::list<u16> Connection::getPeerIDs()
} }
} // namespace } // namespace

@ -68,12 +68,12 @@ inline wchar_t* chartowchar_t(const char *str)
MultiByteToWideChar( CP_UTF8, 0, (LPCSTR) str, -1, (WCHAR *) nstr, nResult ); MultiByteToWideChar( CP_UTF8, 0, (LPCSTR) str, -1, (WCHAR *) nstr, nResult );
} }
#else #else
size_t l = strlen(str)+1; size_t l = strlen(str);
nstr = new wchar_t[l]; nstr = new wchar_t[l+1];
std::wstring intermediate = narrow_to_wide(str); std::wstring intermediate = narrow_to_wide(str);
memset(nstr,0,l); memset(nstr, 0, (l+1)*sizeof(wchar_t));
memcpy(nstr,intermediate.c_str(),l*sizeof(wchar_t)); memcpy(nstr, intermediate.c_str(), l*sizeof(wchar_t));
#endif #endif
return nstr; return nstr;

@ -81,6 +81,7 @@ GUIFormSpecMenu::GUIFormSpecMenu(irr::IrrlichtDevice* dev,
m_selected_amount(0), m_selected_amount(0),
m_selected_dragging(false), m_selected_dragging(false),
m_tooltip_element(NULL), m_tooltip_element(NULL),
m_old_tooltip_id(-1),
m_allowclose(true), m_allowclose(true),
m_lock(false), m_lock(false),
m_form_src(fsrc), m_form_src(fsrc),

@ -1018,4 +1018,3 @@ void ContentFeatures::deSerializeOld(std::istream &is, int version)
throw SerializationError("unsupported ContentFeatures version"); throw SerializationError("unsupported ContentFeatures version");
} }
} }