Skip to content

Commit

Permalink
Issue #1780: Don't free the memory used for resolving the path when c…
Browse files Browse the repository at this point in the history
…hecking POSIX ACLs until after all uses. (#1791)
  • Loading branch information
Castaglia committed Mar 31, 2024
1 parent 61fce5b commit fcaf732
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions modules/mod_facl.c
Original file line number Diff line number Diff line change
Expand Up @@ -1001,8 +1001,6 @@ static int facl_fsio_access(pr_fs_t *fs, const char *path, int mode,
if (acls == NULL) {
xerrno = errno;

destroy_pool(tmp_pool);

pr_trace_msg(trace_channel, 5, "unable to retrieve ACL for '%s': [%d] %s",
path, xerrno, strerror(xerrno));

Expand All @@ -1015,13 +1013,16 @@ static int facl_fsio_access(pr_fs_t *fs, const char *path, int mode,

pr_trace_msg(trace_channel, 6, "normal access check for '%s' "
"failed: %s", path, strerror(xerrno));
destroy_pool(tmp_pool);
errno = xerrno;
return -1;
}

destroy_pool(tmp_pool);
return 0;
}

destroy_pool(tmp_pool);
errno = xerrno;
return -1;
}
Expand All @@ -1032,8 +1033,6 @@ static int facl_fsio_access(pr_fs_t *fs, const char *path, int mode,
if (nents < 0) {
xerrno = errno;

destroy_pool(tmp_pool);

pr_trace_msg(trace_channel, 5,
"unable to retrieve ACL count for '%s': [%d] %s", path, xerrno,
strerror(xerrno));
Expand All @@ -1047,13 +1046,16 @@ static int facl_fsio_access(pr_fs_t *fs, const char *path, int mode,

pr_trace_msg(trace_channel, 6, "normal access check for '%s' "
"failed: %s", path, strerror(xerrno));
destroy_pool(tmp_pool);
errno = xerrno;
return -1;
}

destroy_pool(tmp_pool);
return 0;
}

destroy_pool(tmp_pool);
errno = xerrno;
return -1;
}
Expand All @@ -1067,8 +1069,6 @@ static int facl_fsio_access(pr_fs_t *fs, const char *path, int mode,
if (nents < 0) {
xerrno = errno;

destroy_pool(tmp_pool);

pr_trace_msg(trace_channel, 5,
"unable to retrieve ACL for '%s': [%d] %s", path, xerrno,
strerror(xerrno));
Expand All @@ -1082,13 +1082,16 @@ static int facl_fsio_access(pr_fs_t *fs, const char *path, int mode,

pr_trace_msg(trace_channel, 6, "normal access check for '%s' "
"failed: %s", path, strerror(xerrno));
destroy_pool(tmp_pool);
errno = xerrno;
return -1;
}

destroy_pool(tmp_pool);
return 0;
}

destroy_pool(tmp_pool);
errno = xerrno;
return -1;
}
Expand Down

0 comments on commit fcaf732

Please sign in to comment.