Fixed write-past-end-of-object error in portal.cpp. Long live valgrind.

Change-Id: Id9c7f660fe77690177c73c178aa5d2efcfddbdcb