staging: bcm2835-audio: fix memory leak in bcm2835_audio_open_connection()
authorAishwarya Pant <aishpant@gmail.com>
Sun, 12 Mar 2017 15:40:07 +0000 (21:10 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 13 Mar 2017 23:57:53 +0000 (07:57 +0800)
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 <aishpant@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c

index af16d0f3e2b302dbbd248eb974089b83a319155a..6e007db9d694fd4beeb6ad5dc7e334405207ec9f 100644 (file)
@@ -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;