summaryrefslogtreecommitdiffstats
path: root/net/netlabel/netlabel_user.c
diff options
context:
space:
mode:
authorPaul Moore <paul.moore@hp.com>2007-08-01 17:12:59 +0200
committerJames Morris <jmorris@namei.org>2007-08-02 17:52:26 +0200
commite6e0871cce2ae04f5790543ad2f4ec36b23260ba (patch)
tree0af9d48482dbdb8b949fb673eb5bf48fd5611cc5 /net/netlabel/netlabel_user.c
parentSELinux: remove redundant pointer checks before calling kfree() (diff)
downloadlinux-e6e0871cce2ae04f5790543ad2f4ec36b23260ba.tar.xz
linux-e6e0871cce2ae04f5790543ad2f4ec36b23260ba.zip
Net/Security: fix memory leaks from security_secid_to_secctx()
The security_secid_to_secctx() function returns memory that must be freed by a call to security_release_secctx() which was not always happening. This patch fixes two of these problems (all that I could find in the kernel source at present). Signed-off-by: Paul Moore <paul.moore@hp.com> Acked-by: Stephen Smalley <sds@tycho.nsa.gov> Signed-off-by: James Morris <jmorris@namei.org>
Diffstat (limited to 'net/netlabel/netlabel_user.c')
-rw-r--r--net/netlabel/netlabel_user.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/net/netlabel/netlabel_user.c b/net/netlabel/netlabel_user.c
index 89dcc485653b..85a96a3fddaa 100644
--- a/net/netlabel/netlabel_user.c
+++ b/net/netlabel/netlabel_user.c
@@ -113,8 +113,10 @@ struct audit_buffer *netlbl_audit_start_common(int type,
if (audit_info->secid != 0 &&
security_secid_to_secctx(audit_info->secid,
&secctx,
- &secctx_len) == 0)
+ &secctx_len) == 0) {
audit_log_format(audit_buf, " subj=%s", secctx);
+ security_release_secctx(secctx, secctx_len);
+ }
return audit_buf;
}