[pan2] Fix: clang static analyzer
- From: Petr Kovář <pmkovar src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pan2] Fix: clang static analyzer
- Date: Sun, 17 Jul 2016 19:29:12 +0000 (UTC)
commit 88e3401cb0acddca069be84f59581a008c608782
Author: Viktoras <freepro ngs ru>
Date: Sun Jul 17 21:26:12 2016 +0200
Fix: clang static analyzer
Bugs found by clang static analyzer.
pan/data/cert-store.cc | 5 +++--
pan/gui/body-pane.cc | 2 +-
pan/gui/e-charset-combo-box.c | 2 +-
pan/gui/group-prefs-dialog.cc | 2 +-
pan/gui/save-attach-ui.cc | 1 +
pan/gui/save-ui.cc | 1 +
pan/tasks/nzb.cc | 2 +-
pan/usenet-utils/blowfish.cc | 2 +-
pan/usenet-utils/gpg.cc | 1 +
9 files changed, 11 insertions(+), 7 deletions(-)
---
diff --git a/pan/data/cert-store.cc b/pan/data/cert-store.cc
index 4db849e..08192ec 100644
--- a/pan/data/cert-store.cc
+++ b/pan/data/cert-store.cc
@@ -206,6 +206,7 @@ bool CertStore::import_from_file(const Quark& server, const char* fn) {
fseek(fp, 0, SEEK_SET);
char * buf = new char[filelen];
size_t dummy(fread(buf, sizeof(char), filelen, fp)); // silence compiler
+ fclose(fp);
gnutls_datum_t in;
in.data = (unsigned char*) buf;
@@ -214,7 +215,7 @@ bool CertStore::import_from_file(const Quark& server, const char* fn) {
gnutls_x509_crt_init(&cert);
gnutls_x509_crt_import(cert, &in, GNUTLS_X509_FMT_PEM);
- delete buf;
+ delete[] buf;
int ret = gnutls_certificate_set_x509_trust(_creds, &cert, 1);
@@ -368,7 +369,7 @@ bool CertStore::add(gnutls_x509_crt_t cert, const Quark& server) {
debug_SSL_verbatim(out);
debug_SSL_verbatim("\n===========================================");
- delete out;
+ delete[] out;
fclose(fp);
chmod(cert_file_name_wp.c_str(), 0600);
diff --git a/pan/gui/body-pane.cc b/pan/gui/body-pane.cc
index c6cb87a..6da7709 100644
--- a/pan/gui/body-pane.cc
+++ b/pan/gui/body-pane.cc
@@ -1214,7 +1214,7 @@ BodyPane :: set_text_from_message (GMimeMessage * message)
GdkPixbuf *pixbuf = gdk_pixbuf_loader_get_pixbuf(pl);
gtk_image_set_from_pixbuf (GTK_IMAGE(_face), pixbuf);
g_object_unref(pl);
- delete buf;
+ delete[] buf;
}
// set the terse headers...
diff --git a/pan/gui/e-charset-combo-box.c b/pan/gui/e-charset-combo-box.c
index 42b1d30..bc557ee 100644
--- a/pan/gui/e-charset-combo-box.c
+++ b/pan/gui/e-charset-combo-box.c
@@ -154,7 +154,7 @@ charset_combo_box_run_dialog (ECharsetComboBox *combo_box)
}
charset = gtk_entry_get_text (entry);
- g_return_if_fail (charset != NULL && charset != '\0');
+ g_return_if_fail (charset != NULL && charset[0] != '\0');
g_object_set_data_full (
object, "charset", g_strdup (charset),
diff --git a/pan/gui/group-prefs-dialog.cc b/pan/gui/group-prefs-dialog.cc
index 8b0f596..e786e4b 100644
--- a/pan/gui/group-prefs-dialog.cc
+++ b/pan/gui/group-prefs-dialog.cc
@@ -183,7 +183,7 @@ namespace
create_spellcheck_combo_box ( const Quark & group,
const GroupPrefs & group_prefs)
{
- GtkWidget * w;
+ GtkWidget * w(NULL);
#ifdef HAVE_GTKSPELL
init_spell();
diff --git a/pan/gui/save-attach-ui.cc b/pan/gui/save-attach-ui.cc
index f03a267..d2b9f30 100644
--- a/pan/gui/save-attach-ui.cc
+++ b/pan/gui/save-attach-ui.cc
@@ -183,6 +183,7 @@ namespace
gtk_list_store_set (store, &iter, 0, key_str, 1, gui_str, -1);
if (active_str == key_str) active = i;
}
+ va_end(args);
GtkWidget * w = gtk_combo_box_new_with_model (GTK_TREE_MODEL(store));
GtkCellRenderer * renderer (gtk_cell_renderer_text_new ());
gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (w), renderer, true);
diff --git a/pan/gui/save-ui.cc b/pan/gui/save-ui.cc
index 64ead52..a3a58ed 100644
--- a/pan/gui/save-ui.cc
+++ b/pan/gui/save-ui.cc
@@ -194,6 +194,7 @@ namespace
gtk_list_store_set (store, &iter, 0, key_str, 1, gui_str, -1);
if (active_str == key_str) active = i;
}
+ va_end(args);
GtkWidget * w = gtk_combo_box_new_with_model (GTK_TREE_MODEL(store));
GtkCellRenderer * renderer (gtk_cell_renderer_text_new ());
gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (w), renderer, true);
diff --git a/pan/tasks/nzb.cc b/pan/tasks/nzb.cc
index 82fdab8..98589f6 100644
--- a/pan/tasks/nzb.cc
+++ b/pan/tasks/nzb.cc
@@ -47,7 +47,7 @@ namespace
GMimeMessage * import_msg(const StringView filename)
{
std::string txt;
- GMimeMessage * msg;
+ GMimeMessage * msg(NULL);
if (file :: get_text_file_contents (filename, txt))
{
GMimeStream * stream = g_mime_stream_mem_new_with_buffer (txt.c_str(), txt.size());
diff --git a/pan/usenet-utils/blowfish.cc b/pan/usenet-utils/blowfish.cc
index b1ee060..645a507 100644
--- a/pan/usenet-utils/blowfish.cc
+++ b/pan/usenet-utils/blowfish.cc
@@ -20,7 +20,7 @@ CBlowFish::CBlowFish ()
CBlowFish::~CBlowFish ()
{
- delete PArray ;
+ delete [] PArray ;
delete [] SBoxes ;
}
diff --git a/pan/usenet-utils/gpg.cc b/pan/usenet-utils/gpg.cc
index a67388c..38226d8 100644
--- a/pan/usenet-utils/gpg.cc
+++ b/pan/usenet-utils/gpg.cc
@@ -76,6 +76,7 @@ namespace pan
break;
case GMIME_CERTIFICATE_TRUST_NEVER:
signer.trust = "Never";
+ break;
case GMIME_CERTIFICATE_TRUST_UNDEFINED:
signer.trust = "Undefined";
break;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]