From f9c6b92a6323f2eee3aec2e434bc54e8a8c4ea93 Mon Sep 17 00:00:00 2001 From: Vincent Stumpf Date: Sun, 13 Aug 2017 14:44:18 -0700 Subject: [PATCH] Fixes memory leak in char-server (#2335) Fixes #2330 Allocated memory in various StringBuf instances was being cleared instead of freeing it completely. --- src/char/int_achievement.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/char/int_achievement.c b/src/char/int_achievement.c index 9eed8239c1..738cdc0099 100644 --- a/src/char/int_achievement.c +++ b/src/char/int_achievement.c @@ -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; }