diff options
author | Werner Koch <wk@gnupg.org> | 2014-04-15 16:40:48 +0200 |
---|---|---|
committer | Werner Koch <wk@gnupg.org> | 2014-04-16 10:18:17 +0200 |
commit | a34afa8f2053d75f276d6d28dbf1a43db0fd9768 (patch) | |
tree | 68526edee70449f07cea73af77424664193a559f | |
parent | gpg: Re-enable secret key deletion. (diff) | |
download | gnupg2-a34afa8f2053d75f276d6d28dbf1a43db0fd9768.tar.xz gnupg2-a34afa8f2053d75f276d6d28dbf1a43db0fd9768.zip |
Two minor code cleanups and one NULL deref on error fix.
* common/estream.c (es_freopen): Remove useless check for STREAM.
* kbx/keybox-blob.c (_keybox_create_x509_blob): Remove useless check
for BLOB.
* tools/sockprox.c (run_proxy): Do not fclose(NULL).
--
Found by Hans-Christoph Steiner with cppcheck.
-rw-r--r-- | common/estream.c | 2 | ||||
-rw-r--r-- | kbx/keybox-blob.c | 4 | ||||
-rw-r--r-- | tools/sockprox.c | 3 |
3 files changed, 5 insertions, 4 deletions
diff --git a/common/estream.c b/common/estream.c index be791a802..6272c81f5 100644 --- a/common/estream.c +++ b/common/estream.c @@ -3101,7 +3101,7 @@ es_freopen (const char *ES__RESTRICT path, const char *ES__RESTRICT mode, } else { - if (stream && path) + if (path) fname_set_internal (stream, path, 1); ESTREAM_UNLOCK (stream); } diff --git a/kbx/keybox-blob.c b/kbx/keybox-blob.c index a38f991a9..ebbcdf8ff 100644 --- a/kbx/keybox-blob.c +++ b/kbx/keybox-blob.c @@ -948,12 +948,12 @@ _keybox_create_x509_blob (KEYBOXBLOB *r_blob, ksba_cert_t cert, leave: release_kid_list (blob->temp_kids); blob->temp_kids = NULL; - if (blob && names) + if (names) { for (i=0; i < blob->nuids; i++) xfree (names[i]); + xfree (names); } - xfree (names); if (rc) { _keybox_release_blob (blob); diff --git a/tools/sockprox.c b/tools/sockprox.c index 9ec89ce25..35935987a 100644 --- a/tools/sockprox.c +++ b/tools/sockprox.c @@ -443,7 +443,8 @@ run_proxy (void) out: pthread_attr_destroy (&thread_attr); - fclose (protocol_file); /* FIXME, err checking. */ + if (protocol_file) + fclose (protocol_file); /* FIXME, err checking. */ return err; } |