26.10.2015, 05:12
Hi
I got some issues with freeing results that i have struggeled with too long. Hopefully you see the problem.
This prints this into server console :
The problem goes when it runs the save (inside loop that goes to 50). If i comment it out, no warnings.
Thanks in advance!
I got some issues with freeing results that i have struggeled with too long. Hopefully you see the problem.
pawn Код:
// This function will load the house's datafile (used when the server is started to load all houses)
HouseFile_Load(HouseID)
{
print("Load house was called");
// Setup local variables
new Query[64], ParameterValue[50], DB:Database, DBResult:result, DBResult:result2;
new cModel, cPass[24], cPaint, components[14], Float:cx, Float:cy, Float:cz, Float:crot, CIns, Col1, Col2, bool:VehicleClamped, bool:VehicleHasPass, cFuel = -1, cHeal = -1;
Database = db_open("DataHouses.db");
format(Query, sizeof(Query), "SELECT * FROM `Houses` WHERE `HouseID` = '%d'", HouseID);
result = db_query(Database, Query);
// A House witht his ID was found < sort of loop inside database
if(db_num_rows(result))
{
print("House found!");
print("Only loading house");
// Save the player data from database to player enum
db_get_field_assoc(result, "HouseAddress", ParameterValue, 50);
format(AHouseData[HouseID][HouseAddress], 50, ParameterValue); // Store the HouseAddress
db_get_field_assoc(result, "HouseName", ParameterValue, 50);
format(AHouseData[HouseID][HouseName], 50, ParameterValue); // Store the HouseName
db_get_field_assoc(result, "HouseX", ParameterValue, 50);
AHouseData[HouseID][HouseX] = floatstr(ParameterValue); // Store the HouseX
db_get_field_assoc(result, "HouseY", ParameterValue, 50);
AHouseData[HouseID][HouseY] = floatstr(ParameterValue); // Store the HouseY
db_get_field_assoc(result, "HouseZ", ParameterValue, 50);
AHouseData[HouseID][HouseZ] = floatstr(ParameterValue); // Store the HouseZ
db_get_field_assoc(result, "HouseInterior", ParameterValue, 50);
AHouseData[HouseID][HouseInterior] = strval(ParameterValue); // Store the HouseInterior
db_get_field_assoc(result, "HouseMaxSlots", ParameterValue, 50);
AHouseData[HouseID][HouseMaxSlots] = strval(ParameterValue); // Store the HouseMaxSlots
db_get_field_assoc(result, "HouseNewMaxSlots", ParameterValue, 50);
AHouseData[HouseID][HouseNewMaxSlots] = strval(ParameterValue); // Store the HouseNewMaxSlots
db_get_field_assoc(result, "HousePrice", ParameterValue, 50);
AHouseData[HouseID][HousePrice] = strval(ParameterValue); // Store the HousePrice
db_get_field_assoc(result, "Owned", ParameterValue, 50);
if (strcmp(ParameterValue, "1", false) == 0) // If the value "Yes" was read
{
AHouseData[HouseID][Owned] = true; // House is owned
print("House set to owned");
}
else
{
AHouseData[HouseID][Owned] = false; // House is not owned
print("House set to not owned");
}
db_get_field_assoc(result, "HouseOpened", ParameterValue, 50);
if (strcmp(ParameterValue, "1", false) == 0) // If the value "Yes" was read
{
AHouseData[HouseID][HouseOpened] = true; // House is open
}
else
{
AHouseData[HouseID][HouseOpened] = false; // House is closed
}
db_get_field_assoc(result, "PlayerIsTycoon", ParameterValue, 50);
if (strcmp(ParameterValue, "1", false) == 0) // If the value "Yes" was read
{
AHouseData[HouseID][PlayerIsTycoon] = true; // House owner is tycoon
}
else
{
AHouseData[HouseID][PlayerIsTycoon] = false; // House owner is not tycoon
}
db_get_field_assoc(result, "Owner", ParameterValue, 50);
format(AHouseData[HouseID][Owner], 24, ParameterValue);
new string[128];
format(string, sizeof(string), "The house owner of HouseID: %d is : %s", HouseID, AHouseData[HouseID][Owner]);
print(string);
db_get_field_assoc(result, "Insurance", ParameterValue, 50);
AHouseData[HouseID][Insurance] = strval(ParameterValue); // Store the Insurance
}
db_free_result(result);
for (new vehicleid; vehicleid < 50; vehicleid++)
{
format(Query, sizeof(Query), "SELECT * FROM `Vehicle` WHERE `HouseID` = '%d'", HouseID);
result2 = db_query(Database, Query);
if(db_num_rows(result2))
{
AVehicleData[vehicleid][BelongsToHouse] = HouseID;
//Setup local variables
new cPanels = 0, cDoors = 0, cLights = 0, cTires = 0;
// Clear all data to start a new vehicle
cModel = 0;
cPaint = 0;
cFuel = -1;
cFuel = -1;
for (new i; i < 14; i++)
{
components[i] = 0;
}
db_get_field_assoc(result2, "Pass", ParameterValue, 50);
format(cPass, 24, ParameterValue); // Store the password
db_get_field_assoc(result2, "Model", ParameterValue, 50);
cModel = strval(ParameterValue); // Store the VehicleModel
db_get_field_assoc(result2, "Fuel", ParameterValue, 50);
cFuel = strval(ParameterValue); // Store the Fuel
db_get_field_assoc(result2, "Heal", ParameterValue, 50);
cHeal = strval(ParameterValue); // Store the Heal
db_get_field_assoc(result2, "PaintJob", ParameterValue, 50);
cPaint = strval(ParameterValue); // Store the VehiclePaintJob
db_get_field_assoc(result2, "Component0", ParameterValue, 50);
components[0] = strval(ParameterValue); // Store the VehicleSpoiler
db_get_field_assoc(result2, "Component1", ParameterValue, 50);
components[1] = strval(ParameterValue); // Store the VehicleRoof
db_get_field_assoc(result2, "Component2", ParameterValue, 50);
components[2] = strval(ParameterValue); // Store the VehicleSideSkirt
db_get_field_assoc(result2, "Component3", ParameterValue, 50);
components[3] = strval(ParameterValue); // Store the VehicleLamps
db_get_field_assoc(result2, "Component4", ParameterValue, 50);
components[4] = strval(ParameterValue); // Store the VehicleNitro
db_get_field_assoc(result2, "Component5", ParameterValue, 50);
components[5] = strval(ParameterValue); // Store the VehicleExhaust
db_get_field_assoc(result2, "Component6", ParameterValue, 50);
components[6] = strval(ParameterValue); // Store the VehicleWheels
db_get_field_assoc(result2, "Component7", ParameterValue, 50);
components[7] = strval(ParameterValue); // Store the VehicleStereo
db_get_field_assoc(result2, "Component8", ParameterValue, 50);
components[8] = strval(ParameterValue); // Store the VehicleHydraulics
db_get_field_assoc(result2, "Component9", ParameterValue, 50);
components[9] = strval(ParameterValue); // Store the VehicleFrontBumper
db_get_field_assoc(result2, "Component10", ParameterValue, 50);
components[10] = strval(ParameterValue); // Store the VehicleRearBumper
db_get_field_assoc(result2, "Component11", ParameterValue, 50);
components[11] = strval(ParameterValue); // Store the VehicleVentRight
db_get_field_assoc(result2, "Component12", ParameterValue, 50);
components[12] = strval(ParameterValue); // Store the VehicleVentLeft
db_get_field_assoc(result2, "Component13", ParameterValue, 50);
components[13] = strval(ParameterValue); // Store the VehicleSpoiler
db_get_field_assoc(result2, "Color1", ParameterValue, 50);
Col1 = strval(ParameterValue); // Store the Color1
db_get_field_assoc(result2, "Color2", ParameterValue, 50);
Col2 = strval(ParameterValue); // Store the Color2
db_get_field_assoc(result2, "SpawnX", ParameterValue, 50);
cx = floatstr(ParameterValue); // Store the VehicleX
db_get_field_assoc(result2, "SpawnY", ParameterValue, 50);
cy = floatstr(ParameterValue); // Store the VehicleY
db_get_field_assoc(result2, "SpawnZ", ParameterValue, 50);
cz = floatstr(ParameterValue); // Store the VehicleZ
db_get_field_assoc(result2, "SpawnRot", ParameterValue, 50);
crot = floatstr(ParameterValue); // Store the VehicleAngle
db_get_field_assoc(result2, "RemainingInsurance", ParameterValue, 50);
CIns = strval(ParameterValue); // Store the Remaining Insurance
db_get_field_assoc(result2, "PanelPanels", ParameterValue, 50);
cPanels = strval(ParameterValue); // Store the Heal
db_get_field_assoc(result2, "PanelDoors", ParameterValue, 50);
cDoors = strval(ParameterValue); // Store the Heal
db_get_field_assoc(result2, "PanelLights", ParameterValue, 50);
cLights = strval(ParameterValue); // Store the Heal
db_get_field_assoc(result2, "PanelTires", ParameterValue, 50);
cTires = strval(ParameterValue); // Store the Heal
db_get_field_assoc(result2, "Clamped", ParameterValue, 50);
if (strcmp(ParameterValue, "1", false) == 0) // If the value "Yes" was read
{
VehicleClamped = true; // Vehicle is clamped
}
else
{
VehicleClamped = false; // Vehicle is not clamped
}
db_get_field_assoc(result2, "HasPass", ParameterValue, 50);
if (strcmp(ParameterValue, "1", false) == 0) // If the value "Yes" was read
{
VehicleHasPass = true; // Vehicle has password
}
else
{
VehicleHasPass = false; // Vehicle has not password
}
// Set both colors to 1 if they are 0 AND if there is a paintjob applied
if ((Col1 == 0) && (cPaint != 0))
{
Col1 = 1;
}
if ((Col2 == 0) && (cPaint != 0))
{
Col2 = 1;
}
// Now add the vehicle to the house and set it's data
vehicleid = House_AddVehicle(HouseID, cModel, cPaint, cPanels, cDoors, cLights, cTires, components, cx, cy, cz, crot, Col1, Col2);
AVehicleData[vehicleid][TPanels] = cPanels;
AVehicleData[vehicleid][TDoors] = cDoors;
AVehicleData[vehicleid][TLights] = cLights;
AVehicleData[vehicleid][TTires] = cTires;
AVehicleData[vehicleid][RemainingInsurance] = CIns;
AVehicleData[vehicleid][Clamped] = VehicleClamped;
AVehicleData[vehicleid][HasPass] = VehicleHasPass;
//Put the password to the vehicle
format(AVehicleData[vehicleid][Pass], 24, cPass); // Store the password
// Also set the fuel (set it to maximum when the fuel parameter wasn't inside the file)
if (cFuel == -1)
{
AVehicleData[vehicleid][Fuel] = MaxFuel;
}
else // If the parameter was there, store it
{
AVehicleData[vehicleid][Fuel] = cFuel;
}
// Also set the heal (set it to maximum when the fuel parameter wasn't inside the file)
if (cHeal == -1)
{
AVehicleData[vehicleid][Heal] = MaxVehHealth;
}
else // If the parameter was there, store it
{
AVehicleData[vehicleid][Heal] = cHeal;
}
SetVehicleToRespawn(vehicleid);
}
db_free_result(result2);
}
print("Load house database closed");
//Close the database
db_close(Database);
return 1;
}
Код:
[07:11:56] Load house was called [07:11:56] House found! [07:11:56] Only loading house [07:11:56] House set to not owned [07:11:56] The house owner of HouseID: 1 is : [07:11:56] Load house database closed [07:11:56] Load house was called [07:11:56] House found! [07:11:56] Only loading house [07:11:56] House set to not owned [07:11:56] The house owner of HouseID: 2 is : [07:11:56] Load house database closed [07:11:56] SQLitei Warning: (db_autofree_result) The autofree pool is full! [07:11:56] SQLitei Warning: (db_autofree_result) The autofree pool is full! [07:11:56] SQLitei Warning: (db_autofree_result) The autofree pool is full! [07:11:56] SQLitei Warning: (db_autofree_result) The autofree pool is full! [07:11:56] SQLitei Warning: (db_autofree_result) The autofree pool is full! [07:11:56] SQLitei Warning: (db_autofree_result) The autofree pool is full! [07:11:56] SQLitei Warning: (db_autofree_result) The autofree pool is full! [07:11:56] SQLitei Warning: (db_autofree_result) The autofree pool is full! [07:11:56] SQLitei Warning: (db_autofree_result) The autofree pool is full! [07:11:56] SQLitei Warning: (db_autofree_result) The autofree pool is full! [07:11:56] SQLitei Warning: (db_autofree_result) The autofree pool is full! [07:11:56] SQLitei Warning: (db_autofree_result) The autofree pool is full! [07:11:56] SQLitei Warning: (db_autofree_result) The autofree pool is full! [07:11:56] SQLitei Warning: (db_autofree_result) The autofree pool is full! [07:11:56] SQLitei Warning: (db_autofree_result) The autofree pool is full! [07:11:56] SQLitei Warning: (db_autofree_result) The autofree pool is full! [07:11:56] SQLitei Warning: (db_autofree_result) The autofree pool is full! [07:11:56] SQLitei Warning: (db_autofree_result) The autofree pool is full! [07:11:56] SQLitei Warning: (db_autofree_result) The autofree pool is full! [07:11:56] SQLitei Warning: (db_autofree_result) The autofree pool is full! [07:11:56] SQLitei Warning: (db_autofree_result) The autofree pool is full! [07:11:56] SQLitei Warning: (db_autofree_result) The autofree pool is full! [07:11:56] SQLitei Warning: (db_autofree_result) The autofree pool is full! [07:11:56] SQLitei Warning: (db_autofree_result) The autofree pool is full! [07:11:56] SQLitei Warning: (db_autofree_result) The autofree pool is full! [07:11:56] SQLitei Warning: (db_autofree_result) The autofree pool is full! [07:11:56] SQLitei Warning: (db_autofree_result) The autofree pool is full! [07:11:56] SQLitei Warning: (db_autofree_result) The autofree pool is full! [07:11:56] SQLitei Warning: (db_autofree_result) The autofree pool is full! [07:11:56] SQLitei Warning: (db_autofree_result) The autofree pool is full! [07:11:56] SQLitei Warning: (db_autofree_result) The autofree pool is full! [07:11:56] SQLitei Warning: (db_autofree_result) The autofree pool is full! [07:11:56] SQLitei Warning: (db_autofree_result) The autofree pool is full! [07:11:56] SQLitei Warning: (db_autofree_result) The autofree pool is full! [07:11:56] SQLitei Warning: (db_autofree_result) The autofree pool is full! [07:11:56] SQLitei Warning: (db_autofree_result) The autofree pool is full! [07:11:56] SQLitei Warning: (db_autofree_result) The autofree pool is full! [07:11:56] SQLitei Warning: (db_autofree_result) The autofree pool is full! [07:11:56] SQLitei Warning: (db_autofree_result) The autofree pool is full! [07:11:56] SQLitei Warning: (db_autofree_result) The autofree pool is full! [07:11:56] SQLitei Warning: (db_autofree_result) The autofree pool is full! [07:11:56] SQLitei Warning: (db_autofree_result) The autofree pool is full! [07:11:56] SQLitei Warning: (db_autofree_result) The autofree pool is full! [07:11:56] SQLitei Warning: (db_autofree_result) The autofree pool is full! [07:11:56] SQLitei Warning: (db_autofree_result) The autofree pool is full! [07:11:56] SQLitei Warning: (db_autofree_result) The autofree pool is full! [07:11:56] SQLitei Warning: (db_autofree_result) The autofree pool is full! [07:11:56] SQLitei Warning: (db_autofree_result) The autofree pool is full! [07:11:56] SQLitei Warning: (db_autofree_result) The autofree pool is full! [07:11:56] SQLitei Warning: (db_autofree_result) The autofree pool is full! [07:11:56] SQLitei Warning: (db_autofree_result) The autofree pool is full! [07:11:56] SQLitei Warning: (db_autofree_result) The autofree pool is full! [07:11:56] SQLitei Warning: (db_autofree_result) The autofree pool is full! [07:11:56] SQLitei Warning: (db_autofree_result) The autofree pool is full! [07:11:56] SQLitei Warning: (db_autofree_result) The autofree pool is full! [07:11:56] SQLitei Warning: (db_autofree_result) The autofree pool is full! [07:11:56] SQLitei Warning: (db_autofree_result) The autofree pool is full! [07:11:56] SQLitei Warning: (db_autofree_result) The autofree pool is full! [07:11:56] SQLitei Warning: (db_autofree_result) The autofree pool is full! [07:11:56] SQLitei Warning: (db_autofree_result) The autofree pool is full! [07:11:56] SQLitei Warning: (db_autofree_result) The autofree pool is full! [07:11:56] SQLitei Warning: (db_autofree_result) The autofree pool is full! [07:11:56] SQLitei Warning: (db_autofree_result) The autofree pool is full! [07:11:56] SQLitei Warning: (db_autofree_result) The autofree pool is full! [07:11:56] SQLitei Warning: (db_autofree_result) The autofree pool is full! [07:11:56] SQLitei Warning: (db_autofree_result) The autofree pool is full! [07:11:56] SQLitei Warning: (db_autofree_result) The autofree pool is full! [07:11:56] SQLitei Warning: (db_autofree_result) The autofree pool is full! [07:11:56] SQLitei Warning: (db_autofree_result) The autofree pool is full! [07:11:56] SQLitei Warning: (db_autofree_result) The autofree pool is full! [07:11:56] SQLitei Warning: (db_autofree_result) The autofree pool is full! [07:11:56] SQLitei Warning: (db_autofree_result) The autofree pool is full! [07:11:56] SQLitei Warning: (db_autofree_result) The autofree pool is full! [07:11:56] SQLitei Warning: (db_autofree_result) The autofree pool is full! [07:11:56] SQLitei Warning: (db_autofree_result) The autofree pool is full! [07:11:56] SQLitei Warning: (db_autofree_result) The autofree pool is full! [07:11:56] SQLitei Warning: (db_autofree_result) The autofree pool is full! [07:11:56] SQLitei Warning: (db_autofree_result) The autofree pool is full!
Thanks in advance!