The existing implementation has memory leaks on two local variables that are not deleted after use. Android app will crash after this issue. add UnitTest for this issue. Fixes golang/go#14346 Change-Id: Ic233d15556ac97b35e00e13279a572c48a03049f Reviewed-on: https://go-review.googlesource.com/19532 Reviewed-by: Elias Naur <elias.naur@gmail.com>