瀏覽代碼

Fixes memory leak in char-server (#2335)

Fixes #2330

Allocated memory in various StringBuf instances was being cleared instead of freeing it completely.
Vincent Stumpf 7 年之前
父節點
當前提交
f9c6b92a63
共有 1 個文件被更改,包括 5 次插入5 次删除
  1. 5 5
      src/char/int_achievement.c

+ 5 - 5
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;
 }