Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Jesper Juhl and committed by
Greg Kroah-Hartman
fafbc202 935d59ff

+1
+1
drivers/staging/speakup/i18n.c
··· 555 555 && index <= MSG_FORMATTED_END) 556 556 && !fmt_validate(speakup_default_msgs[index], 557 557 newstr)) { 558 + kfree(newstr); 558 559 return -EINVAL; 559 560 } 560 561 spk_lock(flags);