mirror of
https://github.com/swaywm/sway.git
synced 2024-11-16 13:13:17 +00:00
Fix use-after-free
This commit is contained in:
parent
d2d6fcd1ff
commit
93d99f3712
|
@ -29,7 +29,6 @@ enum secure_feature get_feature_policy(pid_t pid) {
|
||||||
FEATURE_FULLSCREEN | FEATURE_KEYBOARD | FEATURE_MOUSE;
|
FEATURE_FULLSCREEN | FEATURE_KEYBOARD | FEATURE_MOUSE;
|
||||||
|
|
||||||
ssize_t len = readlink(path, link, sizeof(link));
|
ssize_t len = readlink(path, link, sizeof(link));
|
||||||
free(path);
|
|
||||||
if (len < 0) {
|
if (len < 0) {
|
||||||
sway_log(L_INFO,
|
sway_log(L_INFO,
|
||||||
"WARNING: unable to read %s for security check. Using default policy.",
|
"WARNING: unable to read %s for security check. Using default policy.",
|
||||||
|
@ -38,6 +37,7 @@ enum secure_feature get_feature_policy(pid_t pid) {
|
||||||
} else {
|
} else {
|
||||||
link[len] = '\0';
|
link[len] = '\0';
|
||||||
}
|
}
|
||||||
|
free(path);
|
||||||
|
|
||||||
for (int i = 0; i < config->feature_policies->length; ++i) {
|
for (int i = 0; i < config->feature_policies->length; ++i) {
|
||||||
struct feature_policy *policy = config->feature_policies->items[i];
|
struct feature_policy *policy = config->feature_policies->items[i];
|
||||||
|
|
Loading…
Reference in a new issue