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@xxxxxxxxx> --- 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 -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html