Calling ta_alloc(0) and then another ta_alloc() (of any size) appears to be returning the same address twice. Having two memory blocks sharing the same address is bad since there is no way for ta_free() to know which to free.
ta_alloc(0) should probably either return NULL or behave the same as if ta_alloc(1) was called.