gh-331: fix incorrect reallocation in tp.h