Permalink
Browse files

fixed memleak

  • Loading branch information...
1 parent 753f945 commit 47a7f740c794b0e97b457574c3003dbc7c50665d @jollyjinx committed Dec 15, 2009
Showing with 7 additions and 1 deletion.
  1. +7 −1 Categories/NSData+RSAAddition.m
@@ -128,25 +128,31 @@ - (bool) RSAcheckSignature:(NSData *)signature withPublicKey:(NSString *)public
if( NULL == newRSA )
{
JLog(@"couldn't create rsa object");
+ BIO_free(publickeymemory);
return nil;
}
}
-
+ BIO_free(publickeymemory);
+
switch( type )
{
case NID_ripemd160: {
if( 1 == verify_ripemd160( (unsigned char *)[self bytes], [self length],(unsigned char *)[signature bytes], [signature length],newRSA) )
{
+ RSA_free(newRSA);
return YES;
}
}break;
case NID_sha1: {
if( 1 == verify_sha1( (unsigned char *)[self bytes], [self length],(unsigned char *)[signature bytes], [signature length],newRSA) )
{
+ RSA_free(newRSA);
return YES;
}
}break;
default: JLog(@"type %d not supported.",type);
+ RSA_free(newRSA);
+
}
DJLog(@"signature did not match");
return NO;

0 comments on commit 47a7f74

Please sign in to comment.