reticulatedpines / magiclantern_simplified

A Git based version of Magic Lantern, for those unwilling or unable to work using Mercurial. The vast majority of branches have been removed, with those thought to be important brought in individually and merged.
GNU General Public License v2.0
142 stars 47 forks source link

EDmac module can leak significant amounts of mem #124

Open reticulatedpines opened 6 months ago

reticulatedpines commented 6 months ago

CreateResLockEntry() returns LockEntry *. modules/edmac/edmac.c can do this in a loop due to find_free_edmac_channels(), and never frees it.

LockEntry has pResources that is also allocated inside CreateResLockEntry(), of variable size (although fixed and small in the case of find_free_edmac_channels()). Max is 32 loops, on 200D 0x28 bytes per loop, 1280 bytes max per call.

Presumably we should free pResources and the LockEntry, although I have not tested this. I think you want to Unlock before the free, to remove avoid dangling pointers in ResourceInfo_global.

Things to check: