|Subject||FOutDa memory leak when Prepare fails|
I have a construct like this:
DataModule := GetFromPool;
DataSet := DataModule.GetDS;
DataSet.Params.AsString := 'some value';
I don't know why the following happens to me only now and not before but:
If i "blotch" the SQL property (DataSet is a TIB_Cursor) i'll get an exception raised from within DataSet.Prepare. I can catch and handle this properly logging even the "ServerSQL". So very good.
However, when the exception occurs before the prepare is finished the FOutDa member of the TIB_Cursor never gets freed. Even if i put a call to DataSet.Unprepare before or after the rollback because the internal prepared flag never gets set so the unprepare is just skipped.
IMHO a check if FOutDa and FInDa would be a boon. I do not know if it should be done as a response to a connection event or in the destructor. I guess it would work to just FreeAndNilMem in the destructor because the other two places uses FreeAndNilMem. At least, putting:
FreeAndNilMem( FInDa );
FreeAndNilMem( FOutDa );