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

List:       openocd-development
Subject:    [OpenOCD-devel] [PATCH]: 79a382f svf: flush the queue before reallocing memory
From:       gerrit () openocd ! org (gerrit)
Date:       2015-07-30 9:02:21
Message-ID: 20150730090222.0EE141980745 () mail ! openocd ! org
[Download RAW message or body]

This is an automated email from Gerrit.

Paul Fertser (fercerpav@gmail.com) just uploaded a new patch set to Gerrit, which you \
can find at http://openocd.zylin.com/2899

-- gerrit

commit 79a382f7b8b73e3db3deca6edfc7a2259d6128f6
Author: Paul Fertser <fercerpav@gmail.com>
Date:   Thu Jul 30 11:55:43 2015 +0300

    svf: flush the queue before reallocing memory
    
    During reallocation a new memory region might be allocated and the old
    one freed. If jtag queue is holding a pointer to the old memory, it will
    segfault during the execution. Avoid this by flushing the queue before a
    reallocation attempt is made.
    
    This should fix ticket #102.
    
    Change-Id: I737fc3f1ebf6d76413a475beb8bf20184fe0233f
    Reported-by: Alex Forencich <aforencich@users.sf.net>
    Signed-off-by: Paul Fertser <fercerpav@gmail.com>

diff --git a/src/svf/svf.c b/src/svf/svf.c
index cf0cfae..15198d9 100644
--- a/src/svf/svf.c
+++ b/src/svf/svf.c
@@ -216,6 +216,7 @@ static int svf_read_command_from_file(FILE *fd);
 static int svf_check_tdo(void);
 static int svf_add_check_para(uint8_t enabled, int buffer_offset, int bit_len);
 static int svf_run_command(struct command_context *cmd_ctx, char *cmd_str);
+static int svf_execute_tap(void);
 
 static FILE *svf_fd;
 static char *svf_read_line;
@@ -277,6 +278,9 @@ static int svf_realloc_buffers(size_t len)
 {
 	void *ptr;
 
+	if (svf_execute_tap() != ERROR_OK)
+		return ERROR_FAIL;
+
 	ptr = realloc(svf_tdi_buffer, len);
 	if (!ptr)
 		return ERROR_FAIL;

-- 

------------------------------------------------------------------------------
_______________________________________________
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