PR review changes

This commit is contained in:
Kenzzer 2024-08-03 14:37:22 +02:00
parent 9a4aa49209
commit 0949fc92a8
No known key found for this signature in database
GPG Key ID: A4474D96720FD722
3 changed files with 6 additions and 5 deletions

View File

@ -44,9 +44,10 @@ MemoryPointer::MemoryPointer(void* ptr, cell_t size) : m_ptr(ptr), m_owned(false
MemoryPointer::~MemoryPointer() MemoryPointer::~MemoryPointer()
{ {
if (m_owned) if (m_owned && m_ptr)
{ {
free(m_ptr); free(m_ptr);
m_ptr = nullptr;
} }
} }

View File

@ -214,7 +214,7 @@ static cell_t smn_GameConfGetAddressEx(IPluginContext *pCtx, const cell_t *param
} }
char *key; char *key;
void* val; void* val = nullptr;
pCtx->LocalToString(params[2], &key); pCtx->LocalToString(params[2], &key);
if (!gc->GetAddress(key, &val) || val == nullptr) if (!gc->GetAddress(key, &val) || val == nullptr)
@ -248,7 +248,7 @@ static cell_t smn_GameConfGetMemSigEx(IPluginContext *pCtx, const cell_t *params
} }
char *key; char *key;
void *val; void *val = nullptr;
pCtx->LocalToString(params[2], &key); pCtx->LocalToString(params[2], &key);
if (!gc->GetMemSig(key, &val) || val == nullptr) if (!gc->GetMemSig(key, &val) || val == nullptr)

View File

@ -121,7 +121,7 @@ methodmap GameData < Handle
// //
// @param name Name of the property to find. // @param name Name of the property to find.
// @return New MemoryPointer handle containing the address calculated on success, or null on failure. // @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. // Returns a function address calculated from a signature.
// //
@ -134,7 +134,7 @@ methodmap GameData < Handle
// //
// @param name Name of the property to find. // @param name Name of the property to find.
// @return New MemoryPointer handle containing the address calculated on success, or null on failure. // @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);
}; };
/** /**