From cd4206764e716f8df8390fa1ab39ee05db3d1835 Mon Sep 17 00:00:00 2001 From: "Jasper St. Pierre" Date: Sun, 28 Dec 2014 19:50:25 -0800 Subject: [PATCH] Remove a few more guards for frees --- src/core/prefs.c | 10 +++------- src/core/screen.c | 3 +-- src/tests/test-runner.c | 3 +-- src/ui/frames.c | 3 +-- src/ui/theme.c | 11 +++-------- 5 files changed, 9 insertions(+), 21 deletions(-) diff --git a/src/core/prefs.c b/src/core/prefs.c index ebba39d15..afbe8ddf9 100644 --- a/src/core/prefs.c +++ b/src/core/prefs.c @@ -571,8 +571,7 @@ handle_preference_init_string (void) if (!cursor->target) meta_bug ("%s must have handler or target\n", cursor->base.key); - if (*(cursor->target)) - g_free (*(cursor->target)); + g_free (*(cursor->target)); value = g_settings_get_string (SETTINGS (cursor->base.schema), cursor->base.key); @@ -728,8 +727,7 @@ handle_preference_update_string (GSettings *settings, inform_listeners = (g_strcmp0 (value, *(cursor->target)) != 0); - if (*(cursor->target)) - g_free(*(cursor->target)); + g_free(*(cursor->target)); *(cursor->target) = value; } @@ -1391,9 +1389,7 @@ theme_name_handler (GVariant *value, if (g_strcmp0 (current_theme, string_value) != 0) { - if (current_theme) - g_free (current_theme); - + g_free (current_theme); current_theme = g_strdup (string_value); queue_changed (META_PREF_THEME); } diff --git a/src/core/screen.c b/src/core/screen.c index 740a584c0..13e8c7f3a 100644 --- a/src/core/screen.c +++ b/src/core/screen.c @@ -835,8 +835,7 @@ meta_screen_free (MetaScreen *screen, if (screen->check_fullscreen_later != 0) meta_later_remove (screen->check_fullscreen_later); - if (screen->monitor_infos) - g_free (screen->monitor_infos); + g_free (screen->monitor_infos); if (screen->tile_preview_timeout_id) g_source_remove (screen->tile_preview_timeout_id); diff --git a/src/tests/test-runner.c b/src/tests/test-runner.c index 3234c5357..7405c886a 100644 --- a/src/tests/test-runner.c +++ b/src/tests/test-runner.c @@ -330,8 +330,7 @@ test_client_do (TestClient *client, out: g_string_free (command, TRUE); - if (line) - g_free (line); + g_free (line); return *error == NULL; } diff --git a/src/ui/frames.c b/src/ui/frames.c index c1571f3d1..18c34a8d7 100644 --- a/src/ui/frames.c +++ b/src/ui/frames.c @@ -609,8 +609,7 @@ meta_frames_unmanage_window (MetaFrames *frames, if (frame->layout) g_object_unref (G_OBJECT (frame->layout)); - if (frame->title) - g_free (frame->title); + g_free (frame->title); g_free (frame); } diff --git a/src/ui/theme.c b/src/ui/theme.c index 8ae9605ce..ad81543fc 100644 --- a/src/ui/theme.c +++ b/src/ui/theme.c @@ -1117,8 +1117,7 @@ meta_color_spec_free (MetaColorSpec *spec) break; case META_COLOR_SPEC_GTK_CUSTOM: - if (spec->data.gtkcustom.color_name) - g_free (spec->data.gtkcustom.color_name); + g_free (spec->data.gtkcustom.color_name); if (spec->data.gtkcustom.fallback) meta_color_spec_free (spec->data.gtkcustom.fallback); DEBUG_FILL_STRUCT (&spec->data.gtkcustom); @@ -2956,9 +2955,7 @@ meta_draw_op_free (MetaDrawOp *op) break; case META_DRAW_RECTANGLE: - if (op->data.rectangle.color_spec) - g_free (op->data.rectangle.color_spec); - + g_free (op->data.rectangle.color_spec); meta_draw_spec_free (op->data.rectangle.x); meta_draw_spec_free (op->data.rectangle.y); meta_draw_spec_free (op->data.rectangle.width); @@ -2966,9 +2963,7 @@ meta_draw_op_free (MetaDrawOp *op) break; case META_DRAW_ARC: - if (op->data.arc.color_spec) - g_free (op->data.arc.color_spec); - + g_free (op->data.arc.color_spec); meta_draw_spec_free (op->data.arc.x); meta_draw_spec_free (op->data.arc.y); meta_draw_spec_free (op->data.arc.width);