grim/guifications2

Fix a bunch of issues scanbuild found
draft
2 months ago, Gary Kramlich
2bcb53eb005d
Parents b4e7788716f6
Children 7f30676c7038
Fix a bunch of issues scanbuild found
--- a/src/gf_action.c Mon Apr 12 17:32:13 2021 -0500
+++ b/src/gf_action.c Mon Apr 12 18:16:46 2021 -0500
@@ -856,7 +856,6 @@
if(conv && type == PURPLE_CONV_TYPE_CHAT) {
if(!chat_sep_added) {
pidgin_separator(menu);
- chat_sep_added = TRUE;
}
pidgin_new_item_from_stock(menu, _("View Chat Log"), NULL,
--- a/src/gf_display.c Mon Apr 12 17:32:13 2021 -0500
+++ b/src/gf_display.c Mon Apr 12 18:16:46 2021 -0500
@@ -740,15 +740,6 @@
return (!g_utf8_collate(target1, target2));
}
-#define GF_DISPLAY_CHECK_PRIORITY G_STMT_START { \
- if(priority1 >= priority2) { \
- gf_display_destroy(display); \
- continue; \
- } else { \
- ret = TRUE; \
- } \
-} G_STMT_END
-
/* Yes this big ugly function... isn't so big and ugly anymore...
* It checks for existing notification from the same buddy, or conv with
* with the same target, and condenses contacts by the use of helper funcs.
@@ -781,14 +772,32 @@
event2 = gf_event_info_get_event(display->info);
priority2 = gf_event_get_priority(event2);
- if(gf_display_condense_check_buddy(info, display->info))
- GF_DISPLAY_CHECK_PRIORITY;
+ if(gf_display_condense_check_buddy(info, display->info)) {
+ if(priority1 >= priority2) {
+ gf_display_destroy(display);
+ continue;
+ }
+
+ ret = TRUE;
+ }
- if(gf_display_condense_check_contact(info, display->info))
- GF_DISPLAY_CHECK_PRIORITY;
+ if(gf_display_condense_check_contact(info, display->info)) {
+ if(priority1 >= priority2) {
+ gf_display_destroy(display);
+ continue;
+ }
+
+ ret = TRUE;
+ }
- if(gf_display_condense_check_target(info, display->info))
- GF_DISPLAY_CHECK_PRIORITY;
+ if(gf_display_condense_check_target(info, display->info)) {
+ if(priority1 >= priority2) {
+ gf_display_destroy(display);
+ continue;
+ }
+
+ ret = TRUE;
+ }
}
/* we only check the stack count if ret is true, because that means one
--- a/src/gf_event.c Mon Apr 12 17:32:13 2021 -0500
+++ b/src/gf_event.c Mon Apr 12 18:16:46 2021 -0500
@@ -97,6 +97,7 @@
else {
purple_debug_info("Guifications", "Event already exists\n");
gf_event_destroy(event);
+ event = NULL;
}
return event;
--- a/src/gf_item_text.c Mon Apr 12 17:32:13 2021 -0500
+++ b/src/gf_item_text.c Mon Apr 12 18:16:46 2021 -0500
@@ -233,6 +233,7 @@
if(item_text->clipping == GF_ITEM_TEXT_CLIPPING_UNKNOWN) {
purple_debug_info("Guifications", "** Error loading text item: "
"'Unknown clipping type'\n");
+ gf_item_text_destroy(item_text);
gf_item_destroy(item);
return NULL;
}
--- a/src/gf_preferences.c Mon Apr 12 17:32:13 2021 -0500
+++ b/src/gf_preferences.c Mon Apr 12 18:16:46 2021 -0500
@@ -651,9 +651,7 @@
} else if (!g_ascii_strncasecmp(name, "http://", 7)) {
/* Oo, a web drag and drop. This is where things
* will start to get interesting */
- gchar *tail;
-
- if ((tail = strrchr(name, '.')) == NULL)
+ if (strrchr(name, '.') == NULL)
return;
/* We'll check this just to make sure. This also lets us do something different on
--- a/src/gf_theme_editor.c Mon Apr 12 17:32:13 2021 -0500
+++ b/src/gf_theme_editor.c Mon Apr 12 18:16:46 2021 -0500
@@ -468,14 +468,7 @@
GfTheme *old = editor.theme;
if(filename) {
- GfNotification *notification;
- GList *l;
-
editor.theme = gf_theme_new_from_file(filename);
-
- for(l = gf_theme_get_notifications(editor.theme); l; l = l->next) {
- notification = GF_NOTIFICATION(l->data);
- }
} else {
GfNotification *master = NULL;
@@ -854,7 +847,9 @@
gfte_dialog_cleanup();
- gfte_store_get_row(&iter, &page, &item);
+ if(gfte_store_get_row(&iter, &page, &item) == NULL) {
+ return;
+ }
if(page == GFTE_PAGE_NOTIFICATION) {
label = g_strdup_printf(_("Are you sure you want to delete this %s notification?"),
@@ -1090,6 +1085,9 @@
gint page;
object = gfte_store_get_row(&parent, &page, &title);
+ if(object == NULL) {
+ return;
+ }
/* we have to grab this early in case the selected node is an item, and we select the
* notification. If we don't grab this, the selection changes kills all the dialogs
@@ -1104,8 +1102,10 @@
gtk_tree_model_iter_parent(GTK_TREE_MODEL(editor.store), &child, &parent);
- if(title)
+ if(title) {
g_free(title);
+ title = NULL;
+ }
sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(editor.tree));
gtk_tree_selection_select_iter(sel, &child);
@@ -1113,8 +1113,10 @@
object = gfte_store_get_row(&parent, &page, &title);
}
- if(title)
+ if(title) {
g_free(title);
+ title = NULL;
+ }
if(!object) {
purple_debug_misc("guifications",
@@ -1231,6 +1233,9 @@
gpointer object;
object = gfte_store_get_row(&sibling, &page, &title);
+ if(object == NULL) {
+ return;
+ }
gtk_tree_model_iter_parent(GTK_TREE_MODEL(editor.store), &parent, &sibling);