core: fix invalid assertion

We miscounted here, and would hit an assert once too early.
This commit is contained in:
Lennart Poettering
2020-07-16 09:13:04 +09:00
committed by Yu Watanabe
parent aeba8dd523
commit 8d5bb13d78
+4 -2
View File
@@ -1725,7 +1725,8 @@ static int build_environment(
assert(p);
assert(ret);
our_env = new0(char*, 15 + _EXEC_DIRECTORY_TYPE_MAX);
#define N_ENV_VARS 15
our_env = new0(char*, N_ENV_VARS + _EXEC_DIRECTORY_TYPE_MAX);
if (!our_env)
return -ENOMEM;
@@ -1873,7 +1874,8 @@ static int build_environment(
}
our_env[n_env++] = NULL;
assert(n_env <= 14 + _EXEC_DIRECTORY_TYPE_MAX);
assert(n_env <= N_ENV_VARS + _EXEC_DIRECTORY_TYPE_MAX);
#undef N_ENV_VARS
*ret = TAKE_PTR(our_env);