Potential memory leak in mpi_exp_mod() when error occurs during
calculation of RR.
diff --git a/ChangeLog b/ChangeLog
index 4f681c1..2a7134d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -43,6 +43,8 @@
      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 3ec6ad0..0e969d5 100644
--- a/library/bignum.c
+++ b/library/bignum.c
@@ -1599,7 +1599,7 @@
 
     mpi_free( &W[1] ); mpi_free( &T ); mpi_free( &Apos );
 
-    if( _RR == NULL )
+    if( _RR == NULL || _RR->p == NULL )
         mpi_free( &RR );
 
     return( ret );