Small memory fixes.

This commit is contained in:
din
2020-05-14 16:19:23 -05:00
parent 09444bcb74
commit 653e8ff6fe
3 changed files with 12 additions and 5 deletions
+5 -1
View File
@@ -123,7 +123,6 @@ static RageSurface *RageSurface_Load_PNG( RageFile *f, const char *fn, char erro
CHECKPOINT_M("Header only png about to be processed.");
img = CreateSurfaceFrom( width, height, 32, 0, 0, 0, 0, nullptr, width*4 );
png_destroy_read_struct( &png, &info_ptr, nullptr );
return img;
}
@@ -255,6 +254,11 @@ static RageSurface *RageSurface_Load_PNG( RageFile *f, const char *fn, char erro
png_read_end( png, info_ptr );
png_destroy_read_struct( &png, &info_ptr, nullptr );
if(row_pointers != nullptr)
{
delete[] row_pointers;
}
return img;
}
@@ -80,6 +80,8 @@ LinuxInputManager::LinuxInputManager()
// Sort devices for more consistent numbering.
std::sort(m_vsPendingEventDevices.begin(), m_vsPendingEventDevices.end(), cmpDevices);
std::sort(m_vsPendingJoystickDevices.begin(), m_vsPendingJoystickDevices.end(), cmpDevices);
closedir(sysClassInput);
}
void LinuxInputManager::InitDriver(InputHandler_Linux_Event* driver)
+5 -4
View File
@@ -3,6 +3,7 @@
#include "RageLog.h"
#include "SignalHandler.h"
#include "GetSysInfo.h"
#include <memory>
#if defined(HAVE_LIBPTHREAD)
#include "archutils/Common/PthreadHelpers.h"
@@ -31,7 +32,7 @@ static int find_stack_direction2( char *p ) NOINLINE;
static int find_stack_direction() NOINLINE;
static vector<SignalHandler::handler> handlers;
SaveSignals *saved_sigs;
unique_ptr<SaveSignals> saved_sigs;
static int signals[] =
{
@@ -143,10 +144,10 @@ static void *CreateStack( int size )
/* Hook up events to fatal signals, so we can clean up if we're killed. */
void SignalHandler::OnClose( handler h )
{
if( saved_sigs == nullptr )
//if the unique_ptr has not been set, then enter.
if( !saved_sigs )
{
saved_sigs = new SaveSignals;
saved_sigs.reset(new SaveSignals());
bool bUseAltSigStack = true;
#if defined(LINUX)