newsize is a long, but storage is an int. This means the allocation could succeed but storage would overflow. Closes #2300