ui: Allocate the custom buffer size in the failure case also

The custom buffer size was not being honored if memory allocation
failed in the first pass.
Also - removing an unnecessary check.

Change-Id: Ie501b2dda3843454405fec05fc898fec5912bd06
Merge branch 'cm-10.1' of git://github.com/CyanogenMod/android_frameworks_native into pa-cm-10.1