Help us help you
Environment
- Operating System version:
- Game/AppID (with version if applicable):
- Current SourceMod version:
- Current SourceMod snapshot:
- Current Metamod: Source snapshot:
Description
I tested similar code in MySQL and it doesn't crash, so this only happens with pgsql
Problematic Code (or Steps to Reproduce)
...
char sClientIP[16], sError[256];
GetClientIP(client, sClientIP, sizeof(sClientIP));
DBStatement hInsertQuery;
FormatEx(g_sQuery, sizeof(g_sQuery), "INSERT INTO test_table (steamid, name, ip, firstjoin) VALUES ($1, $2, $3, $4) ON CONFLICT (steamid) DO NOTHING");
if ((hInsertQuery = SQL_PrepareQuery(g_hDataBase, g_sQuery, sError, sizeof(sError))) == null)
{
delete hInsertQuery;
LogError("Failed %s", sError);
return;
}
hInsertQuery.BindString(0, players[client].steamid, false);
hInsertQuery.BindString(1, players[client].name, false);
hInsertQuery.BindString(2, sClientIP, false);
hInsertQuery.BindInt(3, GetTime());
if (SQL_Execute(hInsertQuery))
{
PrintToServer("InsertQuery Success!");
}
delete hInsertQuery; // server crash
...
Logs
server console
InsertQuery Success!
free(): invalid pointer
**server crash**
Help us help you
Environment
Description
I tested similar code in MySQL and it doesn't crash, so this only happens with pgsql
Problematic Code (or Steps to Reproduce)
Logs
server console