Replace free(val); val=NULL; with g_clear_pointer

This commit is contained in:
Benedikt Heine 2018-07-06 18:05:57 +02:00
parent ae370e7289
commit e4b0aae05a
3 changed files with 4 additions and 8 deletions

View File

@ -289,8 +289,7 @@ static notification *dbus_message_to_notification(const gchar *sender, GVariant
n->transient = transient; n->transient = transient;
if (actions->count < 1) { if (actions->count < 1) {
actions_free(actions); g_clear_pointer(&actions, actions_free);
actions = NULL;
} }
n->actions = actions; n->actions = actions;
@ -484,8 +483,7 @@ static int dbus_get_fdn_daemon_info(GDBusConnection *connection,
if (error) { if (error) {
/* Ignore the error, we may still be able to retrieve the PID */ /* Ignore the error, we may still be able to retrieve the PID */
g_error_free(error); g_clear_pointer(&error, g_error_free);
error = NULL;
} else { } else {
g_variant_get(daemoninfo, "(ssss)", name, vendor, NULL, NULL); g_variant_get(daemoninfo, "(ssss)", name, vendor, NULL, NULL);
} }

View File

@ -66,9 +66,8 @@ void free_ini(void)
g_free(sections[i].entries); g_free(sections[i].entries);
g_free(sections[i].name); g_free(sections[i].name);
} }
g_free(sections); g_clear_pointer(&sections, g_free);
section_count = 0; section_count = 0;
sections = NULL;
} }
section_t *get_section(const char *name) section_t *get_section(const char *name)

View File

@ -27,8 +27,7 @@ void rule_apply(rule_t *r, notification *n)
if (r->new_icon) { if (r->new_icon) {
g_free(n->icon); g_free(n->icon);
n->icon = g_strdup(r->new_icon); n->icon = g_strdup(r->new_icon);
rawimage_free(n->raw_icon); g_clear_pointer(&n->raw_icon, rawimage_free);
n->raw_icon = NULL;
} }
if (r->fg) { if (r->fg) {
g_free(n->colors[ColFG]); g_free(n->colors[ColFG]);