From 11888ab48044aa9e59038630e282224810d5150f Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Mon, 1 Jul 2002 11:36:48 +0000 Subject: [PATCH] * gpgmeplug.c (findCertificates): Reintroduced a free which must have been removed after my last fix. This avoids a memory leak when a fingerprint was not found. Removed the double loop increment in the code to release the arrays. --- trunk/gpgmeplug/ChangeLog | 7 +++++++ trunk/gpgmeplug/gpgmeplug.c | 4 ++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/trunk/gpgmeplug/ChangeLog b/trunk/gpgmeplug/ChangeLog index 85bc4ed..bf8acd8 100644 --- a/trunk/gpgmeplug/ChangeLog +++ b/trunk/gpgmeplug/ChangeLog @@ -1,3 +1,10 @@ +2002-07-01 Werner Koch + + * gpgmeplug.c (findCertificates): Reintroduced a free which must + have been removed after my last fix. This avoids a memory leak + when a fingerprint was not found. Removed the double loop + increment in the code to release the arrays. + 2002-06-28 Werner Koch * gpgmeplug.c (xmalloc): New. diff --git a/trunk/gpgmeplug/gpgmeplug.c b/trunk/gpgmeplug/gpgmeplug.c index f681b1e..538f569 100644 --- a/trunk/gpgmeplug/gpgmeplug.c +++ b/trunk/gpgmeplug/gpgmeplug.c @@ -2363,6 +2363,7 @@ bool findCertificates( const char* addressee, break; } } + free (dn); } } } @@ -2378,7 +2379,7 @@ bool findCertificates( const char* addressee, *certificates = xmalloc( sizeof(char) * siz ); memset( *certificates, 0, sizeof(char) * siz ); /* fill the buffer */ - for( iFound=0; iFound < nFound; ++iFound ) { + for (iFound=0; iFound < nFound; iFound++) { if( !iFound ) strcpy(*certificates, DNs[iFound] ); else { @@ -2388,7 +2389,6 @@ bool findCertificates( const char* addressee, strcat( *certificates, openBracket ); strcat( *certificates, FPRs[iFound] ); strcat( *certificates, closeBracket ); - ++iFound; free( DNs[ iFound ] ); free( FPRs[iFound ] ); } -- 2.26.2