Page 1 of 1

OpenElfTags() - free memory

Posted: Thu Sep 24, 2020 6:58 pm
by softwarefailure
When using OET_MemoryAddr with OpenElfTags(): Can I free the memory as soon as OpenElfTags() succeeds or do I have to keep the buffer until I call CloseElfTags()?

Re: OpenElfTags() - free memory

Posted: Sat Oct 03, 2020 11:37 am
by tonyw
Not an expert on this, but reading the docs, I understand it this way:

It depends on whether the ELF image that you provided is likely to be referenced again. Some of the tags provided may allow you to get further information later (eg the DOSHook), and clearly the original ELF image must still be around for that.

In general, you must assume that library calls do NOT copy any offered data unless the docs specifically say so. To be safe, I would assume that you need to preserve the input buffer until you call CloseELF().