Fixes memory leak in char-server (#2335)

Fixes #2330

Allocated memory in various StringBuf instances was being cleared instead of freeing it completely.
This commit is contained in:
Vincent Stumpf 2017-08-13 14:44:18 -07:00 committed by Lemongrass3110
parent fcc4936b23
commit f9c6b92a63

View File

@ -78,7 +78,7 @@ struct achievement *mapif_achievements_fromsql(uint32 char_id, int *count)
}
SqlStmt_Free(stmt);
StringBuf_Clear(&buf);
StringBuf_Destroy(&buf);
ShowInfo("achievement load complete from DB - id: %d (total: %d)\n", char_id, *count);
@ -134,11 +134,11 @@ bool mapif_achievement_add(uint32 char_id, struct achievement ad)
if (SQL_ERROR == Sql_QueryStr(sql_handle, StringBuf_Value(&buf))) {
Sql_ShowDebug(sql_handle);
StringBuf_Clear(&buf);
StringBuf_Destroy(&buf);
return false;
}
StringBuf_Clear(&buf);
StringBuf_Destroy(&buf);
return true;
}
@ -172,11 +172,11 @@ bool mapif_achievement_update(uint32 char_id, struct achievement ad)
if (SQL_ERROR == Sql_QueryStr(sql_handle, StringBuf_Value(&buf))) {
Sql_ShowDebug(sql_handle);
StringBuf_Clear(&buf);
StringBuf_Destroy(&buf);
return false;
}
StringBuf_Clear(&buf);
StringBuf_Destroy(&buf);
return true;
}