This is an automated email from Gerrit.

Paul Fertser ([email protected]) just uploaded a new patch set to Gerrit, 
which you can find at http://openocd.zylin.com/2695

-- gerrit

commit bd881c1a7fb71b4d011f4b22977c57730dda6e87
Author: Paul Fertser <[email protected]>
Date:   Sat Apr 4 20:50:37 2015 +0300

    flash/nor/lpc2000: properly free working area used in get_lpc2000_part_id()
    
    The IAP working area needs to be freed here, just like in all the
    other driver functions since an automatic local variable is used to
    store a pointer to it.
    
    This was reported by quitte (Jonas Meyer) on IRC as a strange totally
    unrelated segfault after doing certain operations (leading to target
    reset) from GDB. He has provided me with remote access to the specific
    machine and configuration that exposed the issue, and after some
    debugging it became apparent that a auto local variable (holding the
    gdb connection pointer) gets overwritten somehow. Placing an
    appropriate breakpoint just before the event and using a watchpoint
    made the cause apparent: reset lead to freeing of all working areas,
    and there was one holding a pointer to a variable that was auto local
    in get_lpc2000_part_id().
    
    Change-Id: I7e634d890135ca0f3b4b311e09e8385a03982bd6
    Signed-off-by: Paul Fertser <[email protected]>

diff --git a/src/flash/nor/lpc2000.c b/src/flash/nor/lpc2000.c
index c2a1fc2..389df68 100644
--- a/src/flash/nor/lpc2000.c
+++ b/src/flash/nor/lpc2000.c
@@ -1240,6 +1240,9 @@ static int get_lpc2000_part_id(struct flash_bank *bank, 
uint32_t *part_id)
           firmwares, so ignore it. */
        lpc2000_iap_call(bank, iap_working_area, 54, param_table, result_table);
 
+       struct target *target = bank->target;
+       target_free_working_area(target, iap_working_area);
+
        /* If the result is zero, the command probably didn't work out. */
        if (result_table[0] == 0)
                return LPC2000_INVALID_COMMAND;

-- 

------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
OpenOCD-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openocd-devel

Reply via email to