diff options
author | Lennart Poettering <lennart@poettering.net> | 2018-11-12 16:50:58 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2018-11-14 17:01:55 +0100 |
commit | e6755a33509f425463ddbbf99839ba3ae6979216 (patch) | |
tree | 0aedbd7362da192e07dd7819ee86a99700bd39e4 /src/locale/localectl.c | |
parent | 13df9c398d60e441a65b11ada491f750947649bf (diff) | |
download | systemd-e6755a33509f425463ddbbf99839ba3ae6979216.tar.gz |
locale-util: introduce common helper locale_variables_free() for freeing locale variable arrays
Diffstat (limited to 'src/locale/localectl.c')
-rw-r--r-- | src/locale/localectl.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/src/locale/localectl.c b/src/locale/localectl.c index c8278a383d..75e7a55676 100644 --- a/src/locale/localectl.c +++ b/src/locale/localectl.c @@ -49,10 +49,10 @@ static void status_info_clear(StatusInfo *info) { } static void print_overridden_variables(void) { - int r; - char *variables[_VARIABLE_LC_MAX] = {}; - LocaleVariable j; + _cleanup_(locale_variables_freep) char *variables[_VARIABLE_LC_MAX] = {}; bool print_warning = true; + LocaleVariable j; + int r; if (arg_transport != BUS_TRANSPORT_LOCAL) return; @@ -75,7 +75,7 @@ static void print_overridden_variables(void) { "locale.LC_IDENTIFICATION", &variables[VARIABLE_LC_IDENTIFICATION]); if (r < 0 && r != -ENOENT) { log_warning_errno(r, "Failed to read /proc/cmdline: %m"); - goto finish; + return; } for (j = 0; j < _VARIABLE_LC_MAX; j++) @@ -88,9 +88,6 @@ static void print_overridden_variables(void) { } else log_warning(" %s=%s", locale_variable_to_string(j), variables[j]); } - finish: - for (j = 0; j < _VARIABLE_LC_MAX; j++) - free(variables[j]); } static void print_status_info(StatusInfo *i) { |