summaryrefslogtreecommitdiff
path: root/drivers/staging/speakup
diff options
context:
space:
mode:
authorJesper Juhl <jj@chaosbits.net>2012-08-07 19:44:54 (GMT)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-08-14 02:32:13 (GMT)
commitfafbc202cd3c6ff1dc77430176c4c41102ebbdfd (patch)
tree40266b9a49ad478720c2b65338591fb8502c7ecc /drivers/staging/speakup
parent935d59ff255896515741c1e5f00f28e630d1c3cf (diff)
downloadlinux-fsl-qoriq-fafbc202cd3c6ff1dc77430176c4c41102ebbdfd.tar.xz
staging: speakup: i18n.c: Fix leak in msg_set()
If we end up returning -EINVAL from the function we will leak the memory allocated to 'newstr' which has been allocated but not yet assigned to anything. Fix the leak by properly freeing the memory again before we return. Signed-off-by: Jesper Juhl <jj@chaosbits.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/speakup')
-rw-r--r--drivers/staging/speakup/i18n.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/staging/speakup/i18n.c b/drivers/staging/speakup/i18n.c
index ca01734..7c1658b 100644
--- a/drivers/staging/speakup/i18n.c
+++ b/drivers/staging/speakup/i18n.c
@@ -555,6 +555,7 @@ ssize_t msg_set(enum msg_index_t index, char *text, size_t length)
&& index <= MSG_FORMATTED_END)
&& !fmt_validate(speakup_default_msgs[index],
newstr)) {
+ kfree(newstr);
return -EINVAL;
}
spk_lock(flags);