[svn] ksba - r265 - trunk/src
svn author marcus
cvs at cvs.gnupg.org
Thu Dec 21 01:35:47 CET 2006
Author: marcus
Date: 2006-12-21 01:35:47 +0100 (Thu, 21 Dec 2006)
New Revision: 265
Modified:
trunk/src/ChangeLog
trunk/src/cms.c
Log:
2006-12-21 Marcus Brinkmann <marcus at g10code.de>
* cms.c (build_enveloped_data_header): Initialize CMS_TREE.
Release CMS_TREE, and also TMPWRT always, just as IMAGE and ROOT.
Modified: trunk/src/ChangeLog
===================================================================
--- trunk/src/ChangeLog 2006-12-20 23:51:48 UTC (rev 264)
+++ trunk/src/ChangeLog 2006-12-21 00:35:47 UTC (rev 265)
@@ -1,5 +1,8 @@
2006-12-21 Marcus Brinkmann <marcus at g10code.de>
+ * cms.c (build_enveloped_data_header): Initialize CMS_TREE.
+ Release CMS_TREE, and also TMPWRT always, just as IMAGE and ROOT.
+
* cert.c (ksba_cert_release): Release CERT->image.
* ber-decoder.c (release_decoder_state): Release D->image.buf on
error.
Modified: trunk/src/cms.c
===================================================================
--- trunk/src/cms.c 2006-12-20 23:51:48 UTC (rev 264)
+++ trunk/src/cms.c 2006-12-21 00:35:47 UTC (rev 265)
@@ -2820,7 +2820,7 @@
{
gpg_error_t err;
int recpno;
- ksba_asn_tree_t cms_tree;
+ ksba_asn_tree_t cms_tree = NULL;
struct certlist_s *certlist;
unsigned char *buf;
const char *s;
@@ -2878,17 +2878,18 @@
err = ksba_asn_create_tree ("cms", &cms_tree);
if (err)
return err;
- /* fixme: we must cms_tree on error */
certlist = cms->cert_list;
if (!certlist)
- return gpg_error (GPG_ERR_MISSING_VALUE); /* oops */
+ {
+ err = gpg_error (GPG_ERR_MISSING_VALUE); /* oops */
+ goto leave;
+ }
-
/* To construct the set we use a temporary writer object */
err = ksba_writer_new (&tmpwrt);
if (err)
- return err;
+ goto leave;
err = ksba_writer_set_mem (tmpwrt, 2048);
if (err)
goto leave;
@@ -2981,11 +2982,16 @@
goto leave;
err = ksba_writer_write (tmpwrt, image, imagelen);
- if (err )
+ if (err)
goto leave;
- /* fixme: release what we don't need */
+
+ xfree (image);
+ _ksba_asn_release_nodes (root);
}
+ ksba_asn_tree_release (cms_tree);
+ cms_tree = NULL;
+
/* Write out the SET filled with all recipient infos */
{
unsigned char *value;
@@ -2997,6 +3003,8 @@
err = gpg_error (GPG_ERR_ENOMEM);
goto leave;
}
+ ksba_writer_release (tmpwrt);
+ tmpwrt = NULL;
err = _ksba_ber_write_tl (cms->writer, TYPE_SET, CLASS_UNIVERSAL,
1, valuelen);
if (!err)
@@ -3040,6 +3048,7 @@
leave:
ksba_writer_release (tmpwrt);
+ ksba_asn_tree_release (cms_tree);
return err;
}
More information about the Gnupg-commits
mailing list