lib/mpi: Fix karactx leak in mpi_powm

Sometimes mpi_powm will leak karactx because a memory allocation
failure causes a bail-out that skips the freeing of karactx.  This
patch moves the freeing of karactx to the end of the function like
everything else so that it can't be skipped.

Fixes: cdec9cb5167a ("crypto: GnuPG based MPI lib - source files...")
Cc: <>
Signed-off-by: Herbert Xu <>
Reviewed-by: Eric Biggers <>
Signed-off-by: Herbert Xu <>
1 file changed