From 6995efe8be2a20723ee391494e7d2910b667834d Mon Sep 17 00:00:00 2001
From: Paul Bakker
Date: Mon, 31 Mar 2014 12:08:17 +0200
Subject: [PATCH] Potential memory leak in mpi_exp_mod() when error occurs
during calculation of RR.
---
ChangeLog | 2 ++
library/bignum.c | 2 +-
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/ChangeLog b/ChangeLog
index 4f681c1dc..2a7134d31 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -43,6 +43,8 @@ Bugfix
of one of them failed
* x509_get_current_time() uses localtime_r() to prevent thread issues
* Some example server programs were not sending the close_notify alert.
+ * Potential memory leak in mpi_exp_mod() when error occurs during
+ calculation of RR.
= Version 1.2.10 released 2013-10-07
Changes
diff --git a/library/bignum.c b/library/bignum.c
index 3ec6ad022..0e969d528 100644
--- a/library/bignum.c
+++ b/library/bignum.c
@@ -1599,7 +1599,7 @@ cleanup:
mpi_free( &W[1] ); mpi_free( &T ); mpi_free( &Apos );
- if( _RR == NULL )
+ if( _RR == NULL || _RR->p == NULL )
mpi_free( &RR );
return( ret );