mirror of
https://github.com/blupi-games/planetblupi
synced 2024-12-30 10:15:36 +01:00
Fix memleak by using a variable on the stack
This commit is contained in:
parent
04f127af19
commit
37da5b3b07
@ -108,21 +108,22 @@ CMovie::fileOpenMovie (const std::string & pFilename)
|
|||||||
if (m_player == nullptr)
|
if (m_player == nullptr)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
pinfo = new Kit_PlayerInfo;
|
Kit_PlayerInfo info;
|
||||||
Kit_GetPlayerInfo (m_player, pinfo);
|
Kit_GetPlayerInfo (m_player, &info);
|
||||||
|
|
||||||
SDL_AudioSpec wanted_spec, audio_spec;
|
SDL_AudioSpec wanted_spec, audio_spec;
|
||||||
|
|
||||||
SDL_memset (&wanted_spec, 0, sizeof (wanted_spec));
|
SDL_memset (&wanted_spec, 0, sizeof (wanted_spec));
|
||||||
wanted_spec.freq = pinfo->audio.samplerate;
|
wanted_spec.freq = info.audio.samplerate;
|
||||||
wanted_spec.format = pinfo->audio.format;
|
wanted_spec.format = info.audio.format;
|
||||||
wanted_spec.channels = pinfo->audio.channels;
|
wanted_spec.channels = info.audio.channels;
|
||||||
m_audioDev = SDL_OpenAudioDevice (nullptr, 0, &wanted_spec, &audio_spec, 0);
|
m_audioDev = SDL_OpenAudioDevice (nullptr, 0, &wanted_spec, &audio_spec, 0);
|
||||||
SDL_PauseAudioDevice (m_audioDev, 0);
|
SDL_PauseAudioDevice (m_audioDev, 0);
|
||||||
|
|
||||||
m_videoTex = SDL_CreateTexture (
|
m_videoTex = SDL_CreateTexture (
|
||||||
g_renderer, pinfo->video.format, SDL_TEXTUREACCESS_STATIC,
|
g_renderer, info.video.format, SDL_TEXTUREACCESS_STATIC, info.video.width,
|
||||||
pinfo->video.width, pinfo->video.height);
|
info.video.height);
|
||||||
|
|
||||||
if (m_videoTex == nullptr)
|
if (m_videoTex == nullptr)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@ -159,7 +160,6 @@ CMovie::CMovie ()
|
|||||||
m_movie = nullptr;
|
m_movie = nullptr;
|
||||||
m_player = nullptr;
|
m_player = nullptr;
|
||||||
m_videoTex = nullptr;
|
m_videoTex = nullptr;
|
||||||
pinfo = nullptr;
|
|
||||||
|
|
||||||
memset (m_audiobuf, 0, sizeof (m_audiobuf));
|
memset (m_audiobuf, 0, sizeof (m_audiobuf));
|
||||||
|
|
||||||
|
@ -52,7 +52,6 @@ protected:
|
|||||||
bool initAVI ();
|
bool initAVI ();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
Kit_PlayerInfo * pinfo;
|
|
||||||
Kit_Source * m_movie;
|
Kit_Source * m_movie;
|
||||||
Kit_Player * m_player;
|
Kit_Player * m_player;
|
||||||
SDL_Texture * m_videoTex;
|
SDL_Texture * m_videoTex;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user