fix off-by-one in memory allocation