[Pkg-gnupg-commit] [gnupg2] 83/159: kbx: Avoid faulty fclose in an error case.
Daniel Kahn Gillmor
dkg at fifthhorseman.net
Wed Jan 27 13:23:56 UTC 2016
This is an automated email from the git hooks/post-receive script.
dkg pushed a commit to branch master
in repository gnupg2.
commit db82b6131d437bf6ba34db0e08b7dfa9edb11e45
Author: Werner Koch <wk at gnupg.org>
Date: Wed Jan 6 08:39:08 2016 +0100
kbx: Avoid faulty fclose in an error case.
* kbx/keybox-update.c (blob_filecopy): Do not close an uninitialized
file pointer after a failure to create a temp file.
* kbx/keybox-openpgp.c (next_packet): Remove duplicate assignment of
PKTLEN.
Signed-off-by: Werner Koch <wk at gnupg.org>
---
kbx/keybox-openpgp.c | 1 -
kbx/keybox-update.c | 3 +--
2 files changed, 1 insertion(+), 3 deletions(-)
diff --git a/kbx/keybox-openpgp.c b/kbx/keybox-openpgp.c
index a5f602b..a0e4ab9 100644
--- a/kbx/keybox-openpgp.c
+++ b/kbx/keybox-openpgp.c
@@ -71,7 +71,6 @@ next_packet (unsigned char const **bufptr, size_t *buflen,
if ( !(ctb & 0x80) )
return gpg_error (GPG_ERR_INV_PACKET); /* Invalid CTB. */
- pktlen = 0;
if ((ctb & 0x40)) /* New style (OpenPGP) CTB. */
{
pkttype = (ctb & 0x3f);
diff --git a/kbx/keybox-update.c b/kbx/keybox-update.c
index ef3e330..aa80865 100644
--- a/kbx/keybox-update.c
+++ b/kbx/keybox-update.c
@@ -271,12 +271,11 @@ blob_filecopy (int mode, const char *fname, KEYBOXBLOB blob,
goto leave;
}
- /* Create the new file. */
+ /* Create the new file. On success NEWFP is initialized. */
rc = create_tmp_file (fname, &bakfname, &tmpfname, &newfp);
if (rc)
{
fclose (fp);
- fclose (newfp);
goto leave;
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-gnupg/gnupg2.git
More information about the Pkg-gnupg-commit
mailing list