Skip to content

Commit

Permalink
PR review changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Kenzzer committed Aug 3, 2024
1 parent 9a4aa49 commit 0949fc9
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
3 changes: 2 additions & 1 deletion core/logic/MemoryPointer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,10 @@ MemoryPointer::MemoryPointer(void* ptr, cell_t size) : m_ptr(ptr), m_owned(false

MemoryPointer::~MemoryPointer()
{
if (m_owned)
if (m_owned && m_ptr)
{
free(m_ptr);
m_ptr = nullptr;
}
}

Expand Down
4 changes: 2 additions & 2 deletions core/logic/smn_gameconfigs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ static cell_t smn_GameConfGetAddressEx(IPluginContext *pCtx, const cell_t *param
}

char *key;
void* val;
void* val = nullptr;
pCtx->LocalToString(params[2], &key);

if (!gc->GetAddress(key, &val) || val == nullptr)
Expand Down Expand Up @@ -248,7 +248,7 @@ static cell_t smn_GameConfGetMemSigEx(IPluginContext *pCtx, const cell_t *params
}

char *key;
void *val;
void *val = nullptr;
pCtx->LocalToString(params[2], &key);

if (!gc->GetMemSig(key, &val) || val == nullptr)
Expand Down
4 changes: 2 additions & 2 deletions plugins/include/sourcemod.inc
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ methodmap GameData < Handle
//
// @param name Name of the property to find.
// @return New MemoryPointer handle containing the address calculated on success, or null on failure.
public native Address GetAddressEx(const char[] name);
public native MemoryPointer GetAddressEx(const char[] name);

// Returns a function address calculated from a signature.
//
Expand All @@ -134,7 +134,7 @@ methodmap GameData < Handle
//
// @param name Name of the property to find.
// @return New MemoryPointer handle containing the address calculated on success, or null on failure.
public native Address GetMemSigEx(const char[] name);
public native MemoryPointer GetMemSigEx(const char[] name);
};

/**
Expand Down

0 comments on commit 0949fc9

Please sign in to comment.