mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-03-03 17:19:39 +00:00
Fixes for "Conditional jump or move depends on uninitialised value(s)"
and memleaks reported by valgrind. Signed-off-by: Lukasz Gromanowski <lgromanowski@gmail.com>
This commit is contained in:
parent
6107d5bad2
commit
cb04f43384
5 changed files with 40 additions and 2 deletions
|
@ -55,6 +55,8 @@ namespace MWGui
|
||||||
, mWorldMouseOver(false)
|
, mWorldMouseOver(false)
|
||||||
, mEnemyHealthTimer(0)
|
, mEnemyHealthTimer(0)
|
||||||
, mIsDrowning(false)
|
, mIsDrowning(false)
|
||||||
|
, mWeaponSpellTimer(0.f)
|
||||||
|
, mDrowningFlashTheta(0.f)
|
||||||
{
|
{
|
||||||
setCoord(0,0, width, height);
|
setCoord(0,0, width, height);
|
||||||
|
|
||||||
|
|
|
@ -16,6 +16,15 @@ namespace MWGui
|
||||||
mLastButtonPressed = -1;
|
mLastButtonPressed = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MessageBoxManager::~MessageBoxManager ()
|
||||||
|
{
|
||||||
|
std::vector<MessageBox*>::iterator it(mMessageBoxes.begin());
|
||||||
|
for (; it != mMessageBoxes.end(); ++it)
|
||||||
|
{
|
||||||
|
delete *it;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void MessageBoxManager::onFrame (float frameDuration)
|
void MessageBoxManager::onFrame (float frameDuration)
|
||||||
{
|
{
|
||||||
std::vector<MessageBox*>::iterator it;
|
std::vector<MessageBox*>::iterator it;
|
||||||
|
|
|
@ -23,6 +23,7 @@ namespace MWGui
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
MessageBoxManager ();
|
MessageBoxManager ();
|
||||||
|
~MessageBoxManager ();
|
||||||
void onFrame (float frameDuration);
|
void onFrame (float frameDuration);
|
||||||
void createMessageBox (const std::string& message, bool stat = false);
|
void createMessageBox (const std::string& message, bool stat = false);
|
||||||
void removeStaticMessageBox ();
|
void removeStaticMessageBox ();
|
||||||
|
|
|
@ -322,6 +322,7 @@ namespace MWGui
|
||||||
delete mSoulgemDialog;
|
delete mSoulgemDialog;
|
||||||
delete mCursorManager;
|
delete mCursorManager;
|
||||||
delete mRecharge;
|
delete mRecharge;
|
||||||
|
delete mCompanionWindow;
|
||||||
|
|
||||||
cleanupGarbage();
|
cleanupGarbage();
|
||||||
|
|
||||||
|
|
|
@ -950,8 +950,22 @@ void VideoState::init(const std::string& resourceName)
|
||||||
|
|
||||||
// Open video file
|
// Open video file
|
||||||
/// \todo leak here, ffmpeg or valgrind bug ?
|
/// \todo leak here, ffmpeg or valgrind bug ?
|
||||||
|
///
|
||||||
|
/// https://trac.ffmpeg.org/ticket/1357
|
||||||
|
///
|
||||||
if(!this->format_ctx || avformat_open_input(&this->format_ctx, resourceName.c_str(), NULL, NULL))
|
if(!this->format_ctx || avformat_open_input(&this->format_ctx, resourceName.c_str(), NULL, NULL))
|
||||||
{
|
{
|
||||||
|
if (this->format_ctx != NULL)
|
||||||
|
{
|
||||||
|
if (this->format_ctx->pb != NULL)
|
||||||
|
{
|
||||||
|
av_free(this->format_ctx->pb->buffer);
|
||||||
|
this->format_ctx->pb->buffer = NULL;
|
||||||
|
|
||||||
|
av_free(this->format_ctx->pb);
|
||||||
|
this->format_ctx->pb = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
// "Note that a user-supplied AVFormatContext will be freed on failure."
|
// "Note that a user-supplied AVFormatContext will be freed on failure."
|
||||||
this->format_ctx = NULL;
|
this->format_ctx = NULL;
|
||||||
av_free(ioCtx);
|
av_free(ioCtx);
|
||||||
|
@ -1009,9 +1023,20 @@ void VideoState::deinit()
|
||||||
|
|
||||||
if(this->format_ctx)
|
if(this->format_ctx)
|
||||||
{
|
{
|
||||||
AVIOContext *ioContext = this->format_ctx->pb;
|
// valgrind shows memleak near format_ctx->pb
|
||||||
|
//
|
||||||
|
// As scrawl pointed, memleak could be related to this ffmpeg ticket:
|
||||||
|
// https://trac.ffmpeg.org/ticket/1357
|
||||||
|
//
|
||||||
|
if (this->format_ctx->pb != NULL)
|
||||||
|
{
|
||||||
|
av_free(this->format_ctx->pb->buffer);
|
||||||
|
this->format_ctx->pb->buffer = NULL;
|
||||||
|
|
||||||
|
av_free(this->format_ctx->pb);
|
||||||
|
this->format_ctx->pb = NULL;;
|
||||||
|
}
|
||||||
avformat_close_input(&this->format_ctx);
|
avformat_close_input(&this->format_ctx);
|
||||||
av_free(ioContext);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue