> It works fine without debugging though, no crash. Any ideas?
Don't turn on debugging and you won't crash! Of course...
> ldap_connect_to_host: TCP (null):7
is a bit bothersome. Are you really trying to connect to NULL? Even worse,
are you trying to printf() the NULL, perhaps when debugging? This is well
known to have Bad Effects.
If it's as simple as starting your program and watching it die, standard
debugging tools (gdb, dbx, valgrind, libumem, librtc) should be able to
pinpoint this fairly concretely.