Don't call those outside of the lib_expunge() vector, if it needs calling ramlib (the process that deals with library opening / closing etc) will call it.Olrick wrote:I was thinking about the cleaning instructions generated in libExpunge() by IDLTool:I thought it was the cleanup of the LibraryBase I get in libInit(), was I wrong ?Code: Select all
libBase->IExec->Remove((struct Node *)libBase); libBase->IExec->DeleteLibrary((struct Library *)libBase);
And is there anything to do with the segList I get from libInit() ?
I guess these two resources got allocated and must be freed in case of failure.
Your init function should just setup library resuorces.
Return the base on success.
On failure cleanup the resources then return NULL.
Your expunge function should cleanup those resources then Remove() and DeleteLibrary() (was FreeMem() for 68k code) .
If you use the same function to cleanup in the initcode as the expunge code (which is sensible) then make sure it NULLs any pointers and test them for NULL so that it can be called twice without double freeing and crashing.
Don't worry about the seglist it's not yours to release.