Sanity checks in JNI code for closure creation

b/20728113

In case the requested size for memory allocation overflows, or memory
allocation fails.

Change-Id: I8dac132dd4d0210938660ffbb82cbe44000d2a90
2 files changed