Merge "allocBuffer: fix reallocation check"