Memory leak in economy/economy.cc split
Bug #1631738 reported by
Hans Joachim Desserud
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
widelands |
Fix Released
|
Low
|
Unassigned |
Bug Description
Hi, I just ran scan-build 3.9 on r8131. The majority of reported memory leaks were the usual boost::bind, but this one also showed up.
Still present in r8227.
Related branches
lp:~widelands-dev/widelands/bug-1732765-economy-refactoring
- Klaus Halfmann: Approve
-
Diff: 1502 lines (+314/-260)26 files modifiedsrc/ai/defaultai.cc (+1/-1)
src/ai/defaultai.h (+1/-1)
src/ai/defaultai_warfare.cc (+2/-2)
src/economy/economy.cc (+19/-18)
src/economy/economy.h (+13/-3)
src/economy/economy_data_packet.cc (+11/-1)
src/economy/economy_data_packet.h (+3/-0)
src/economy/flag.cc (+14/-8)
src/economy/flag.h (+6/-2)
src/game_io/game_player_economies_packet.cc (+30/-36)
src/io/filesystem/filesystem.cc (+6/-7)
src/logic/game.cc (+3/-4)
src/logic/map_objects/tribes/ship.cc (+30/-23)
src/logic/map_objects/tribes/ship.h (+4/-1)
src/logic/player.cc (+45/-35)
src/logic/player.h (+8/-14)
src/logic/playercommand.cc (+8/-8)
src/logic/playercommand.h (+2/-2)
src/logic/widelands.h (+1/-0)
src/map_io/map_flag_packet.cc (+14/-3)
src/scripting/lua_bases.cc (+4/-4)
src/scripting/lua_game.cc (+7/-9)
src/scripting/lua_map.cc (+4/-4)
src/wui/economy_options_window.cc (+57/-50)
src/wui/economy_options_window.h (+14/-9)
src/wui/stock_menu.cc (+7/-15)
description: | updated |
Changed in widelands: | |
status: | Confirmed → In Progress |
assignee: | nobody → GunChleoc (gunchleoc) |
milestone: | none → build20-rc1 |
Changed in widelands: | |
status: | In Progress → Fix Committed |
assignee: | GunChleoc (gunchleoc) → nobody |
To post a comment you must log in.
The Economy constructor adds the economy to a vector owned by Player and the memory is managed in that class. So, I think we should be fine here.
We could change the design a bit though: Instead of calling the Economy constructor and player. add_economy( *this); inside the Economy constructor, we could shift constructing the Economy object to the player.add_economy function. IMO this would make the control flow clearer.