locale-setup: clear partially loaded context on failure

This commit is contained in:
Yu Watanabe
2022-12-14 20:18:58 +09:00
parent 018befcff6
commit 50359113e9
+3 -6
View File
@@ -135,13 +135,10 @@ int locale_context_load(LocaleContext *c, LocaleLoadFlag flag) {
r = locale_context_load_env(c, flag);
finalize:
if (r < 0)
return r;
if (r == 0) {
/* Nothing loaded. */
if (r <= 0) {
/* Nothing loaded, or error. */
locale_context_clear(c);
return 0;
return r;
}
if (FLAGS_SET(flag, LOCALE_LOAD_SIMPLIFY))