aboutsummaryrefslogtreecommitdiffstats
path: root/sway/security.c
diff options
context:
space:
mode:
authorLibravatar Drew DeVault <sir@cmpwn.com>2016-12-02 18:57:10 -0500
committerLibravatar Drew DeVault <sir@cmpwn.com>2016-12-02 18:57:10 -0500
commit93d99f37126b93176677fb22cf7500d10f3db6e4 (patch)
treec3139753ff61578fefce9636fed583dd35f490e3 /sway/security.c
parentFix clang issues (diff)
downloadsway-93d99f37126b93176677fb22cf7500d10f3db6e4.tar.gz
sway-93d99f37126b93176677fb22cf7500d10f3db6e4.tar.zst
sway-93d99f37126b93176677fb22cf7500d10f3db6e4.zip
Fix use-after-free
Diffstat (limited to 'sway/security.c')
-rw-r--r--sway/security.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/sway/security.c b/sway/security.c
index 0d510253..1d236b1d 100644
--- a/sway/security.c
+++ b/sway/security.c
@@ -29,7 +29,6 @@ enum secure_feature get_feature_policy(pid_t pid) {
29 FEATURE_FULLSCREEN | FEATURE_KEYBOARD | FEATURE_MOUSE; 29 FEATURE_FULLSCREEN | FEATURE_KEYBOARD | FEATURE_MOUSE;
30 30
31 ssize_t len = readlink(path, link, sizeof(link)); 31 ssize_t len = readlink(path, link, sizeof(link));
32 free(path);
33 if (len < 0) { 32 if (len < 0) {
34 sway_log(L_INFO, 33 sway_log(L_INFO,
35 "WARNING: unable to read %s for security check. Using default policy.", 34 "WARNING: unable to read %s for security check. Using default policy.",
@@ -38,6 +37,7 @@ enum secure_feature get_feature_policy(pid_t pid) {
38 } else { 37 } else {
39 link[len] = '\0'; 38 link[len] = '\0';
40 } 39 }
40 free(path);
41 41
42 for (int i = 0; i < config->feature_policies->length; ++i) { 42 for (int i = 0; i < config->feature_policies->length; ++i) {
43 struct feature_policy *policy = config->feature_policies->items[i]; 43 struct feature_policy *policy = config->feature_policies->items[i];