[PATCH 1/3] drivers: staging: wilc1000: Check for errors before kfree

Chandra S Gorentla
2015-10-02T13:18:22Z

During the clean-up of the function, it is need to check if
errors occurred, not the memory pointer.

Signed-off-by: Chandra S Gorentla <csgorentla@gmail.com>
---
drivers/staging/wilc1000/wilc_msgqueue.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/wilc1000/wilc_msgqueue.c b/drivers/staging/wilc1000/wilc_msgqueue.c
index d5ebd6d..1b73b63 100644
--- a/drivers/staging/wilc1000/wilc_msgqueue.c
+++ b/drivers/staging/wilc1000/wilc_msgqueue.c
@@ -105,7 +105,7 @@ int wilc_mq_send(WILC_MsgQueueHandle *pHandle,

ERRORHANDLER:
/* error occured, free any allocations */
- if (pstrMessage) {
+ if (result) {
kfree(pstrMessage->pvBuffer);
kfree(pstrMessage);
}
--
2.1.4