/pidgin/main: 93b8292b2779: Fix remaining clang scan-build warnings

Tomasz Wasilczyk twasilczyk at pidgin.im
Thu Apr 3 13:40:07 EDT 2014


Changeset: 93b8292b2779df49bda981d2eb40a79b33389716
Author:	 Tomasz Wasilczyk <twasilczyk at pidgin.im>
Date:	 2014-04-03 19:39 +0200
Branch:	 default
URL: https://hg.pidgin.im/pidgin/main/rev/93b8292b2779

Description:

Fix remaining clang scan-build warnings

diffstat:

 finch/libgnt/gnttextview.c       |  9 ++++++++-
 libpurple/protocols/silc/buddy.c |  2 ++
 2 files changed, 10 insertions(+), 1 deletions(-)

diffs (45 lines):

diff --git a/finch/libgnt/gnttextview.c b/finch/libgnt/gnttextview.c
--- a/finch/libgnt/gnttextview.c
+++ b/finch/libgnt/gnttextview.c
@@ -339,6 +339,9 @@ gnt_text_view_clicked(GntWidget *widget,
 			g_return_val_if_fail(select_start != NULL, TRUE);
 
 			select_end = gnt_text_view_get_p(view, x - widget->priv.x, y - widget->priv.y);
+
+			g_return_val_if_fail(select_end != NULL, TRUE);
+
 			if (select_end < select_start) {
 				gchar *t = select_start;
 				select_start = select_end;
@@ -762,7 +765,7 @@ int gnt_text_view_tag_change(GntTextView
 				GntTextLine *line = iter->data;
 				inext = iter->next;
 
-				if (line == NULL) {
+				if (G_UNLIKELY(line == NULL)) {
 					g_warn_if_reached();
 					continue;
 				}
@@ -780,6 +783,10 @@ int gnt_text_view_tag_change(GntTextView
 						/* This segment starts in the middle of the tag */
 						if (text == NULL) {
 							free_text_segment(seg, NULL);
+							if (G_UNLIKELY(line == NULL)) {
+								g_warn_if_reached();
+								break;
+							}
 							line->segments = g_list_delete_link(line->segments, segs);
 							if (line->segments == NULL) {
 								free_text_line(line, NULL);
diff --git a/libpurple/protocols/silc/buddy.c b/libpurple/protocols/silc/buddy.c
--- a/libpurple/protocols/silc/buddy.c
+++ b/libpurple/protocols/silc/buddy.c
@@ -1290,6 +1290,8 @@ silcpurple_add_buddy_resolved(SilcClient
 		}
 	}
 
+	g_return_if_fail(client_entry != NULL);
+
 	/* The client was found.  Now get its public key and verify
 	   that before adding the buddy. */
 	memset(&userpk, 0, sizeof(userpk));



More information about the Commits mailing list