Call EVP_CIPHER_CTX_free instead of EVP_CIPHER_CTX_cleanup. The latter doesn't OpenSSL_free memory allocated by EVP_CIPHER_CTX_new. It's worth noting that EVP_CIPHER_CTX_free doesn't check the return value of EVP_CIPHER_CTX_cleanup so we can't throw if cleanup failed, but we were only ever calling this method from a finalizer anyway. (cherry picked from commit c64652932d8e17ccf7e54c0c76c1b38a86841732) bug: 18617384 Change-Id: Ida65e14ffbed41f56a59e2f5fe77289cac0f5947