From: Jesper Juhl Date: Sun, 23 Jan 2011 21:40:42 +0000 (+0100) Subject: trusted keys: Fix a memory leak in trusted_update(). X-Git-Tag: v2.6.38-rc3~74^2~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5403110943a2dcf1f96416d7a412a8b46895facd;p=platform%2Fkernel%2Flinux-stable.git trusted keys: Fix a memory leak in trusted_update(). One failure path in security/keys/trusted.c::trusted_update() does not free 'new_p' while the others do. This patch makes sure we also free it in the remaining path (if datablob_parse() returns different from Opt_update). Signed-off-by: Jesper Juhl Signed-off-by: James Morris --- diff --git a/security/keys/trusted.c b/security/keys/trusted.c index 3066f56..83fc92e 100644 --- a/security/keys/trusted.c +++ b/security/keys/trusted.c @@ -1032,6 +1032,7 @@ static int trusted_update(struct key *key, const void *data, size_t datalen) ret = datablob_parse(datablob, new_p, new_o); if (ret != Opt_update) { ret = -EINVAL; + kfree(new_p); goto out; } /* copy old key values, and reseal with new pcrs */