Fix newly generated coverity warnings release-2.x.y

Mon, 12 May 2014 22:08:04 +0200

author
Tomasz Wasilczyk <twasilczyk@pidgin.im>
date
Mon, 12 May 2014 22:08:04 +0200
branch
release-2.x.y
changeset 36027
175e769076e1
parent 36026
ee9d95cb8ee6
child 36028
fc5300cb3617

Fix newly generated coverity warnings

libpurple/log.c file | annotate | diff | comparison | revisions
libpurple/protocols/silc/util.c file | annotate | diff | comparison | revisions
pidgin/plugins/spellchk.c file | annotate | diff | comparison | revisions
--- a/libpurple/log.c	Mon May 12 21:22:30 2014 +0200
+++ b/libpurple/log.c	Mon May 12 22:08:04 2014 +0200
@@ -1716,6 +1716,7 @@
 		if (st.st_mtime < log_last_modified)
 		{
 			purple_debug_warning("log", "Index \"%s\" exists, but is older than the log.\n", pathstr);
+			close(index_fd);
 		}
 		else
 		{
--- a/libpurple/protocols/silc/util.c	Mon May 12 21:22:30 2014 +0200
+++ b/libpurple/protocols/silc/util.c	Mon May 12 22:08:04 2014 +0200
@@ -268,12 +268,10 @@
 					close(fd);
 					return FALSE;
 				}
-			}
-			/* This shouldn't really happen because silc_create_key_pair()
-			 * will set the permissions */
-			else if ((fstat(fd, &st)) == -1) {
-				purple_debug_error("silc", "Couldn't stat '%s' private key, error: %s\n",
-						   file_private_key, g_strerror(errno));
+			} else {
+				purple_debug_error("silc", "Couldn't open '%s' "
+					"private key, error: %s\n",
+					file_private_key, g_strerror(errno));
 				return FALSE;
 			}
 		} else {
--- a/pidgin/plugins/spellchk.c	Mon May 12 21:22:30 2014 +0200
+++ b/pidgin/plugins/spellchk.c	Mon May 12 22:08:04 2014 +0200
@@ -1790,7 +1790,7 @@
 	model = gtk_list_store_new((gint)N_COLUMNS, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_BOOLEAN, G_TYPE_BOOLEAN);
 	hashes = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL);
 
-	while (buf_get_line(ibuf, &buf, &pnt, size)) {
+	while (ibuf && buf_get_line(ibuf, &buf, &pnt, size)) {
 		if (*buf != '#') {
 			if (!g_ascii_strncasecmp(buf, "BAD ", 4))
 			{

mercurial