diff options
author | Michael Vetter <jubalh@iodoru.org> | 2021-07-17 23:13:01 +0200 |
---|---|---|
committer | Michael Vetter <jubalh@iodoru.org> | 2021-07-17 23:13:01 +0200 |
commit | 9bd635d7e6ef1823c84430d9314b3bfe18ac30c6 (patch) | |
tree | db9b98e9cd170336942bc225b29d9056f451fa1c /src | |
parent | ba414eb0aca2a4178cbf5244e8c266f213cb4497 (diff) | |
download | profani-tty-9bd635d7e6ef1823c84430d9314b3bfe18ac30c6.tar.gz |
accounts: get rid of guard around free
Diffstat (limited to 'src')
-rw-r--r-- | src/config/accounts.c | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/src/config/accounts.c b/src/config/accounts.c index 6018cfff..83934012 100644 --- a/src/config/accounts.c +++ b/src/config/accounts.c @@ -908,9 +908,7 @@ accounts_get_last_presence(const char* const account_name) result = RESOURCE_ONLINE; } - if (setting) { - g_free(setting); - } + g_free(setting); return result; } @@ -939,14 +937,11 @@ accounts_get_login_presence(const char* const account_name) } else if (strcmp(setting, "last") == 0) { result = accounts_get_last_presence(account_name); } else { - log_warning("Error reading presence.login for account: '%s', value: '%s', defaulting to 'online'", - account_name, setting); + log_warning("Error reading presence.login for account: '%s', value: '%s', defaulting to 'online'", account_name, setting); result = RESOURCE_ONLINE; } - if (setting) { - g_free(setting); - } + g_free(setting); return result; } @@ -955,13 +950,12 @@ accounts_get_login_status(const char* const account_name) { gchar* setting = g_key_file_get_string(accounts, account_name, "presence.login", NULL); gchar* status = NULL; + if (g_strcmp0(setting, "last") == 0) { status = accounts_get_last_status(account_name); } - if (setting) { - g_free(setting); - } + g_free(setting); return status; } |