[PATCH 2/2] mpicalc: free memory also when in error branch.

Ismo Puustinen ismo.puustinen at intel.com
Wed Aug 5 14:27:44 CEST 2015


Fixing an issue found by static analysis.

Signed-off-by: Ismo Puustinen <ismo.puustinen at intel.com>
---
 src/mpicalc.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/mpicalc.c b/src/mpicalc.c
index f1fbbef..96d9013 100644
--- a/src/mpicalc.c
+++ b/src/mpicalc.c
@@ -204,6 +204,7 @@ do_inv (void)
   if (stackidx < 2)
     {
       fputs ("stack underflow\n", stderr);
+      mpi_release (a);
       return;
     }
   mpi_invm (a, stack[stackidx - 2], stack[stackidx - 1]);
@@ -219,6 +220,7 @@ do_gcd (void)
   if (stackidx < 2)
     {
       fputs ("stack underflow\n", stderr);
+      mpi_release (a);
       return;
     }
   mpi_gcd (a, stack[stackidx - 2], stack[stackidx - 1]);
-- 
2.4.3




More information about the Gcrypt-devel mailing list