aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKarl-Heinz Zimmer <[email protected]>2002-07-01 12:08:24 +0000
committerKarl-Heinz Zimmer <[email protected]>2002-07-01 12:08:24 +0000
commita4b45557eadadff1abe1fad613bf1c1ff4db5a26 (patch)
tree72380ada13ecb03f771f4ebbd99652a50aea1f3c
parent* gpgmeplug.c (findCertificates): Reintroduced a free which must (diff)
downloadgpgme-a4b45557eadadff1abe1fad613bf1c1ff4db5a26.tar.gz
gpgme-a4b45557eadadff1abe1fad613bf1c1ff4db5a26.zip
avoid another memory leak in checkMessageSignature()
Diffstat (limited to '')
-rw-r--r--gpgmeplug/gpgmeplug.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/gpgmeplug/gpgmeplug.c b/gpgmeplug/gpgmeplug.c
index 538f569e..a5804bd0 100644
--- a/gpgmeplug/gpgmeplug.c
+++ b/gpgmeplug/gpgmeplug.c
@@ -2353,7 +2353,7 @@ bool findCertificates( const char* addressee,
siz += strlen( s2 );
siz += strlen( closeBracket );
DNs[ nFound ] = dn;
- dn = NULL;
+ dn = NULL; // prevent it from being free'ed below
FPRs[nFound ] = xstrdup( s2 );
++nFound;
if( nFound >= MAXCERTS ) {
@@ -2376,7 +2376,7 @@ bool findCertificates( const char* addressee,
++siz;
*newSize = siz;
/* allocate the buffer */
- *certificates = xmalloc( sizeof(char) * siz );
+ *certificates = xmalloc( sizeof(char) * siz );
memset( *certificates, 0, sizeof(char) * siz );
/* fill the buffer */
for (iFound=0; iFound < nFound; iFound++) {
@@ -2451,7 +2451,6 @@ bool checkMessageSignature( char** cleartext,
GpgmeKey key;
time_t created;
struct DnPair* a;
- char* dn;
int sig_idx=0;
int UID_idx=0;
const char* statusStr;
@@ -2599,9 +2598,7 @@ bool checkMessageSignature( char** cleartext,
attr_string = gpgme_key_get_string_attr(key, GPGME_ATTR_USERID, 0, 0);
if (attr_string != 0) {
a = parse_dn( attr_string );
- dn = reorder_dn( a );
- storeNewCharPtr( &sigmeta->extended_info[sig_idx].userid,
- dn );
+ sigmeta->extended_info[sig_idx].userid = reorder_dn( a );
}
attr_ulong = gpgme_key_get_ulong_attr(key, GPGME_ATTR_USERID, 0, 0);
@@ -2623,9 +2620,7 @@ bool checkMessageSignature( char** cleartext,
attr_string = gpgme_key_get_string_attr(key, GPGME_ATTR_NAME, 0, 0);
if (attr_string != 0) {
a = parse_dn( attr_string );
- dn = reorder_dn( a );
- storeNewCharPtr( &sigmeta->extended_info[sig_idx].name,
- dn );
+ sigmeta->extended_info[sig_idx].name = reorder_dn( a );
}
/* extract email(s) */