[freetds] [ freetds-Patches-1120675 ] new features in ctlib

ZIGLIO, Frediano, VF-IT Frediano.Ziglio at vodafone.com
Thu Feb 17 09:32:22 EST 2005



> > Fixed... tds_cursor_close can deallocare cursor, 
> > in this case reset cmd->cursor too.
> 
> I've looked at your fix. If it works, it's as good as I could come up
> with at the moment....
> I may take a close look at the cursor code, with the benefit of
> hindsight. 
> I'd prefer to reset cmd->cursor when we receive back the DONE 
> status for
> the cursor dealloc/close-with-dealloc
> I can't see a way to do this yet, but I may come up with something.
> 
> Thanks for your help,
> 
> Bill 
> 

IMO if you free cursors in libTDS you should not attempt to keep
pointers or check some conditions and free cursor by yourself, you are
going to have pointers to garbage, double free and other memory errors
(heap corruption and so on).
Current code (cursor deallocation == free) is safe however as you noted
you have cursors in libTDS that are not in upper layer libraries.
Another solution is that libTDS notify upper layer of deallocation and
let upper layer libraries to it cleanup (or even free cursor)...

freddy77


More information about the FreeTDS mailing list