Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#2122 closed defect (fixed)

[PATCH]Small possible memory leak in network/fsm.cpp

Reported by: Riemer Owned by: ben
Priority: Should Have Milestone: Alpha 15
Component: Core engine Keywords: patch
Cc: Patch:

Description (last modified by Riemer)

In the function CFsm::AddTransition the pointer to pEvent is lost when allocating pNewTransition fails. Although I doubt the leak will cause a problem when it occurs (the non-allocating will probably cause more havoc), it is atleast something I found after a day worth of digging.

ps. I must add, this is quite a nice codebase! Really educational

Affected sourefile: source/network/fsm.cpp

note: this is based on the git repo

Attachments (1)

save.patch (463 bytes ) - added by Riemer 11 years ago.
Patch file, apply in root of 0ad

Download all attachments as: .zip

Change History (6)

by Riemer, 11 years ago

Attachment: save.patch added

Patch file, apply in root of 0ad

comment:1 by Riemer, 11 years ago

Description: modified (diff)

comment:2 by Riemer, 11 years ago

Keywords: review patch added
Summary: Small possible memory leak in network/fsm.cpp[PATCH]Small possible memory leak in network/fsm.cpp

comment:3 by historic_bruno, 11 years ago

I think CppCheck or similar report this issue, and it could certainly be a memory leak. I don't know if anyone has ever hit that code path, as you say the leak would be the least problem, but freeing it is technically the correct thing to do.

comment:4 by ben, 11 years ago

Owner: set to ben
Resolution: fixed
Status: newclosed

In 13980:

Fixes hypothetical mem leak in network code (and an error in Cppcheck), patch by Riemer, fixes #2122

comment:5 by historic_bruno, 11 years ago

Keywords: review removed
Note: See TracTickets for help on using tickets.