Merge branch 'va-fixes-reported-by-pvs' into 'main'

Fix issues spotted by PVS-Studio

See merge request GNOME/gtk!6558
This commit is contained in:
Matthias Clasen
2023-11-15 00:27:08 +00:00
18 changed files with 39 additions and 21 deletions

View File

@@ -430,7 +430,6 @@ update_columns (GtkTreeView *view, ViewColumnModel *view_model)
int *new_order;
GtkTreePath *path;
new_order = g_new (int, length);
a = old_columns; b = view_model->columns;
while (a->data == b->data)
@@ -442,6 +441,8 @@ update_columns (GtkTreeView *view, ViewColumnModel *view_model)
m++;
}
new_order = g_new (int, length);
if (a->next->data == b->data)
{
b = b->next;

View File

@@ -9,7 +9,7 @@ static const char *format_name[] = {
static const char *
format_to_string (GdkMemoryFormat format)
{
if (format < GDK_MEMORY_N_FORMATS)
if (format < g_strv_length ((gchar **) format_name))
return format_name[format];
else
return "ERROR";