]> git.baikalelectronics.ru Git - kernel.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)
commit67331a3ba8a86fc4858f7197207eec9927f71ec3
tree3de11a87269d91bff7fe50f1a14a14edd8b4ef4c
parent4b4015a22a7852fae9d2109a9b6548456d84ce95
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