This is an automated email from Gerrit.

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

-- gerrit

commit 0bfb26dda86d7b161f870807c421010552e294c8
Author: Spencer Oliver <[email protected]>
Date:   Fri Mar 28 11:11:13 2014 +0000

    target: remove handle_profile_command memory leak
    
    COMMAND_PARSE_NUMBER may return, thus any memory allocated may not be
    freed, simple reorder fixes the issue.
    
    Change-Id: I0ce444a5b032f5c49b6d33a03a8c0b71cad49c8c
    Signed-off-by: Spencer Oliver <[email protected]>

diff --git a/src/target/target.c b/src/target/target.c
index c09dfd8..b868383 100644
--- a/src/target/target.c
+++ b/src/target/target.c
@@ -3620,14 +3620,15 @@ COMMAND_HANDLER(handle_profile_command)
        uint32_t offset;
        uint32_t num_of_sampels;
        int retval = ERROR_OK;
+
+       COMMAND_PARSE_NUMBER(u32, CMD_ARGV[0], offset);
+
        uint32_t *samples = malloc(sizeof(uint32_t) * MAX_PROFILE_SAMPLE_NUM);
        if (samples == NULL) {
                LOG_ERROR("No memory to store samples.");
                return ERROR_FAIL;
        }
 
-       COMMAND_PARSE_NUMBER(u32, CMD_ARGV[0], offset);
-
        /**
         * Some cores let us sample the PC without the
         * annoying halt/resume step; for example, ARMv7 PCSR.

-- 

------------------------------------------------------------------------------
_______________________________________________
OpenOCD-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openocd-devel

Reply via email to