allocBuffer: fix reallocation check

Behavior Before Change:
- first call to allocBuffer will allocate buffer of atleast 1048576 bytes
- second call to allocBuffer with a size < remaining size in buffer will result in a reallocation

Behavior After Change:
- first call to allocBuffer will allocate buffer of atleast 1048576 bytes
- second call to allocBuffer with a size < remaining size in buffer will NOT result in a reallocation

New test added : NoReallocationIfBufferIsNotFull
Test Results: https://paste.googleplex.com/5387396978835456

Change-Id: I58e765f264ae5180c1408803872cbdc74554d2ff
2 files changed