summaryrefslogtreecommitdiffstats
path: root/security
diff options
context:
space:
mode:
Diffstat (limited to 'security')
-rw-r--r--security/apparmor/apparmorfs.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/security/apparmor/apparmorfs.c b/security/apparmor/apparmorfs.c
index 62301ddbbe5e..f4308683c0af 100644
--- a/security/apparmor/apparmorfs.c
+++ b/security/apparmor/apparmorfs.c
@@ -1497,8 +1497,10 @@ static char *gen_symlink_name(int depth, const char *dirname, const char *fname)
}
error = snprintf(s, size, "raw_data/%s/%s", dirname, fname);
- if (error >= size || error < 0)
+ if (error >= size || error < 0) {
+ kfree(buffer);
return ERR_PTR(-ENAMETOOLONG);
+ }
return buffer;
}