Commit 9b4d7acf authored by Tycho Andersen's avatar Tycho Andersen Committed by Pavel Emelyanov

lsm: don't leak apparmor string in the case of "unconfined"

Noticed this when I was looking over the LSM code for Cyrill's task =>
thread creds set. We set this to null to save some work later, but we
forget to free it first.
Signed-off-by: 's avatarTycho Andersen <tycho.andersen@canonical.com>
Acked-by: 's avatarCyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 57f16168
......@@ -53,8 +53,10 @@ static int apparmor_get_label(pid_t pid, char **profile_name)
* An "unconfined" value means there is no profile, so we don't need to
* worry about trying to restore one.
*/
if (strcmp(*profile_name, "unconfined") == 0)
if (strcmp(*profile_name, "unconfined") == 0) {
free(*profile_name);
*profile_name = NULL;
}
return 0;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment