Fix some memory errors (bug 5904, r=ds).
This commit is contained in:
+1
-4
@@ -212,7 +212,7 @@ void CHalfLife2::InitCommandLine()
|
||||
return;
|
||||
}
|
||||
|
||||
ILibrary *lib = g_LibSys.OpenLibrary(path, error, sizeof(error));
|
||||
ke::AutoPtr<ILibrary> lib(g_LibSys.OpenLibrary(path, error, sizeof(error)));
|
||||
m_pGetCommandLine = lib->GetSymbolAddress("CommandLine_Tier0");
|
||||
|
||||
/* '_Tier0' dropped on Alien Swarm version */
|
||||
@@ -224,7 +224,6 @@ void CHalfLife2::InitCommandLine()
|
||||
if (m_pGetCommandLine == NULL)
|
||||
{
|
||||
/* We probably have a Ship engine. */
|
||||
lib->CloseLibrary();
|
||||
g_SourceMod.BuildPath(Path_Game, path, sizeof(path), "../bin/" VSTDLIB_NAME);
|
||||
if (!g_LibSys.IsPathFile(path))
|
||||
{
|
||||
@@ -244,8 +243,6 @@ void CHalfLife2::InitCommandLine()
|
||||
{
|
||||
g_Logger.LogError("Could not locate any command line functionality");
|
||||
}
|
||||
|
||||
lib->CloseLibrary();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
#include <ISourceMod.h>
|
||||
#include "common_logic.h"
|
||||
#include "PluginSys.h"
|
||||
#include <am-utility.h>
|
||||
|
||||
CExtensionManager g_Extensions;
|
||||
IdentityType_t g_ExtType;
|
||||
@@ -537,11 +538,9 @@ void CExtensionManager::TryAutoload()
|
||||
|
||||
g_pSM->BuildPath(Path_SM, path, sizeof(path), "extensions");
|
||||
|
||||
IDirectory *pDir = libsys->OpenDirectory(path);
|
||||
ke::AutoPtr<IDirectory> pDir(libsys->OpenDirectory(path));
|
||||
if (!pDir)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const char *lfile;
|
||||
size_t len;
|
||||
|
||||
@@ -186,6 +186,7 @@ static bool get_game_name(char *buffer, size_t maxlength)
|
||||
if ((str = pGameInfo->GetString("game", NULL)) != NULL)
|
||||
{
|
||||
strncopy(buffer, str, maxlength);
|
||||
pGameInfo->deleteThis();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user