Hi Marty,
I removed the following line ... But I fear that this is probably a memory leak that I just created.
I would share this fear. Probably the leak is not large, since the nsdb driver keeps typically (dependent on the configuration) the connection open for a long time, so this is probably not a big memory leak.
However, when looking at the source code, there is something strange: In case, the connect operation fails, the "connect" data is freed via tds_free_login(). The manual [1] shows, that tds_read_config_info() returns actually a "TDSLOGIN *", so tds_free_login() might be indeed the right operation.
Can you check whether this works?
All the best -g
[1] https://www.freetds.org/reference/a00574.html#ga9ff2436ea56ddcdecf984acf46ce4b90