Don't write out more than we have allocated in obj_txt, as the glory
that is OBJ_obj2txt() can return a larger value..
ok tedu@
no need for null check before free. from Brendan MacDonell