diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2018-05-30 01:35:26 +0900 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2018-05-31 16:17:18 +0900 |
commit | 6a837b035fa69f02f20815d00ce6c261b9f1a2e9 (patch) | |
tree | dabd49bedd3348f1c0db3bcf1922928622adc6b9 /src/locale | |
parent | fe28d8874637ef159d350ecde562bd1dd799e932 (diff) | |
download | systemd-6a837b035fa69f02f20815d00ce6c261b9f1a2e9.tar.gz |
locale: use _cleanup_free_ and free_and_replace
Diffstat (limited to 'src/locale')
-rw-r--r-- | src/locale/keymap-util.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/locale/keymap-util.c b/src/locale/keymap-util.c index 7cc2eb4407..50f7a1b7f7 100644 --- a/src/locale/keymap-util.c +++ b/src/locale/keymap-util.c @@ -668,7 +668,7 @@ int x11_convert_to_vconsole(Context *c) { context_free_vconsole(c); } else { - char *new_keymap = NULL; + _cleanup_free_ char *new_keymap = NULL; int r; r = find_converted_keymap(c->x11_layout, c->x11_variant, &new_keymap); @@ -687,12 +687,10 @@ int x11_convert_to_vconsole(Context *c) { c->x11_layout); if (!streq_ptr(c->vc_keymap, new_keymap)) { - free(c->vc_keymap); - c->vc_keymap = new_keymap; + free_and_replace(c->vc_keymap, new_keymap); c->vc_keymap_toggle = mfree(c->vc_keymap_toggle); modified = true; - } else - free(new_keymap); + } } if (modified) |