]> git.karo-electronics.de Git - linux-beck.git/commit
cw1200: Don't leak memory if krealloc failes
authorJohannes Thumshirn <jthumshirn@suse.de>
Fri, 30 Sep 2016 12:39:17 +0000 (14:39 +0200)
committerKalle Valo <kvalo@codeaurora.org>
Wed, 9 Nov 2016 01:36:44 +0000 (03:36 +0200)
commit9afdd6128c39f42398041bb2e017d8df0dcebcd1
tree3de11a87269d91bff7fe50f1a14a14edd8b4ef4c
parent424342ff0e033f5965a446fc6e37aba2c9cee248
cw1200: Don't leak memory if krealloc failes

The call to krealloc() in wsm_buf_reserve() directly assigns the newly
returned memory to buf->begin. This is all fine except when krealloc()
failes we loose the ability to free the old memory pointed to by
buf->begin. If we just create a temporary variable to assign memory to
and assign the memory to it we can mitigate the memory leak.

Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
Cc: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
drivers/net/wireless/st/cw1200/wsm.c