[PATCHv2 3/3] staging: bcm: fix memory leak in Bcmchar.c file

Kevin McKinney klmckinney1 at gmail.com
Mon Aug 15 19:12:15 PDT 2011


commit 78cfe85eac64c553278719f691e743969aadf1f2
Author: Kevin McKinney <klmckinney1 at gmail.com>
Date:   Sun Aug 14 21:11:13 2011 -0400

    Staging: bcm: Fix memory leak reported during compile.
    
    This patch fixes a potential memory leak were temp_buff buffer
    is not being freed when a certain condition is true.
    
    Signed-off-by: Kevin McKinney <klmckinney1 at gmail.com>

diff --git a/drivers/staging/bcm/Bcmchar.c b/drivers/staging/bcm/Bcmchar.c
index d3f3856..6f8a75d 100644
--- a/drivers/staging/bcm/Bcmchar.c
+++ b/drivers/staging/bcm/Bcmchar.c
@@ -304,6 +304,8 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
 
 			BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "RDM Done On invalid Address : %x Access Denied.\n",
 					(int)sRdmBuffer.Register);
+
+			kfree(temp_buff);
 			return -EINVAL;
 		}
 


More information about the devel mailing list