[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openocd-development
Subject:    [OpenOCD-devel] [PATCH]: 166d3bc Fix for warnings detected by clang static analyzer
From:       gerrit () openocd ! org (gerrit)
Date:       2018-03-22 11:03:55
Message-ID: 20180322110355.A6C672522922 () mail ! openocd ! org
[Download RAW message or body]

This is an automated email from Gerrit.

Michele Sardo (msmttchr@gmail.com) just uploaded a new patch set to Gerrit, which you \
can find at http://openocd.zylin.com/4476

-- gerrit

commit 166d3bcf78f6e0843bc3bb3136d307b4ffff13a7
Author: Michele Sardo <msmttchr@gmail.com>
Date:   Thu Mar 22 12:02:19 2018 +0100

    Fix for warnings detected by clang static analyzer
    
    Fix for potential memory leakage and for unused/unreported return error code
    
    Change-Id: Ifb2c95b60637c3a241ad4bf41d1a328c92ccea4b
    Signed-off-by: Michele Sardo <msmttchr@gmail.com>

diff --git a/src/flash/nor/bluenrg-x.c b/src/flash/nor/bluenrg-x.c
index c4a8080..2b56859 100644
--- a/src/flash/nor/bluenrg-x.c
+++ b/src/flash/nor/bluenrg-x.c
@@ -274,6 +274,7 @@ static int bluenrgx_write_bytes(struct target *target, uint32_t \
address_base, ui  if (pre_bytes) {
 			if (target_read_u32(target, pre_address, &pre_word)) {
 				LOG_ERROR("Memory read failed");
+				free(new_buffer);
 				return ERROR_FAIL;
 			}
 
@@ -282,6 +283,7 @@ static int bluenrgx_write_bytes(struct target *target, uint32_t \
address_base, ui  if (post_bytes) {
 			if (target_read_u32(target, post_address, &post_word)) {
 				LOG_ERROR("Memory read failed");
+				free(new_buffer);
 				return ERROR_FAIL;
 			}
 
@@ -450,6 +452,9 @@ static int bluenrgx_write(struct flash_bank *bank, const uint8_t \
*buffer,  destroy_reg_param(&reg_params[2]);
 		destroy_reg_param(&reg_params[3]);
 		destroy_reg_param(&reg_params[4]);
+		if (retval != ERROR_OK)
+			return retval;
+
 	}
 
 	/* Program chunk at end, not addressable by fast burst write algorithm */

-- 

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
OpenOCD-devel mailing list
OpenOCD-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openocd-devel


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic