Skip to content

Commit 8665a22

Browse files
committed
Add note why we don't call free
1 parent 1692fd4 commit 8665a22

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

judge/runguard.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -806,6 +806,8 @@ void setrestrictions()
806806

807807
/* Set additional environment variables. */
808808
for (const auto &tokens : environment_variables) {
809+
// Note that we explicitly *do not* free the string created by
810+
// strdup as putenv does not copy that string, but uses it as is.
809811
char *token = strtok(strdup(tokens.c_str()), ";");
810812
while (token != nullptr) {
811813
verbose("setting environment variable: %s", token);

0 commit comments

Comments
 (0)