From 0adbfd4694c2b2ae2f48b04295eadafed70612ad Mon Sep 17 00:00:00 2001 From: Aishwarya Pant Date: Sun, 12 Mar 2017 21:10:07 +0530 Subject: [PATCH] staging: bcm2835-audio: fix memory leak in bcm2835_audio_open_connection() In bcm2835_audio_open_connection(), if VCHI connection fails or initialisation of VCHI audio instance fails vchi_instance needs to be deallocated otherwise it will cause a memory leak. Signed-off-by: Aishwarya Pant Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c index af16d0f3e2b3..6e007db9d694 100644 --- a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c +++ b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c @@ -446,6 +446,7 @@ static int bcm2835_audio_open_connection(struct bcm2835_alsa_stream *alsa_stream LOG_DBG(" success !\n"); ret = 0; err_free_mem: + kfree(vchi_instance); LOG_DBG(" .. OUT\n"); return ret;