diff options
author | mifi <mifi@b42882b7-edfa-0310-969c-e2dbd0fdcd60> | 2007-12-18 21:20:28 +0000 |
---|---|---|
committer | mifi <mifi@b42882b7-edfa-0310-969c-e2dbd0fdcd60> | 2007-12-18 21:20:28 +0000 |
commit | 02f3765351c9e25185b745b84f1a2604fb2149c7 (patch) | |
tree | 81331db01e68baf67bc2cc271b1f1ed2a6962d76 /src/target | |
parent | ed1e9d6abdece4fbf6251a11f0eca3c921221048 (diff) | |
download | openocd+libswd-02f3765351c9e25185b745b84f1a2604fb2149c7.tar.gz openocd+libswd-02f3765351c9e25185b745b84f1a2604fb2149c7.tar.bz2 openocd+libswd-02f3765351c9e25185b745b84f1a2604fb2149c7.tar.xz openocd+libswd-02f3765351c9e25185b745b84f1a2604fb2149c7.zip |
- added patch for new flash functionality like:
flash verify_image and flash erase_address.
- added patch for new parport_write_on_exit command.
Even this patch will fix some memory leaks.
(thanks too oyvind and Spen for these patches)
git-svn-id: svn://svn.berlios.de/openocd/trunk@240 b42882b7-edfa-0310-969c-e2dbd0fdcd60
Diffstat (limited to 'src/target')
-rw-r--r-- | src/target/algorithm.c | 2 | ||||
-rw-r--r-- | src/target/etm.c | 2 | ||||
-rw-r--r-- | src/target/image.c | 24 | ||||
-rw-r--r-- | src/target/trace.c | 2 |
4 files changed, 29 insertions, 1 deletions
diff --git a/src/target/algorithm.c b/src/target/algorithm.c index c5ee4708..c4450ac1 100644 --- a/src/target/algorithm.c +++ b/src/target/algorithm.c @@ -41,6 +41,7 @@ void init_mem_param(mem_param_t *param, u32 address, u32 size, enum param_direct void destroy_mem_param(mem_param_t *param) { free(param->value); + param->value = NULL; } void init_reg_param(reg_param_t *param, char *reg_name, u32 size, enum param_direction direction) @@ -54,4 +55,5 @@ void init_reg_param(reg_param_t *param, char *reg_name, u32 size, enum param_dir void destroy_reg_param(reg_param_t *param) { free(param->value); + param->value = NULL; } diff --git a/src/target/etm.c b/src/target/etm.c index 1a20d862..0b8a8f5f 100644 --- a/src/target/etm.c +++ b/src/target/etm.c @@ -1200,6 +1200,7 @@ int handle_etm_tracemode_command(struct command_context_s *cmd_ctx, char *cmd, c if (arm7_9->etm_ctx->trace_depth > 0) { free(arm7_9->etm_ctx->trace_data); + arm7_9->etm_ctx->trace_data = NULL; } arm7_9->etm_ctx->trace_depth = 0; } @@ -1725,6 +1726,7 @@ int handle_etm_start_command(struct command_context_s *cmd_ctx, char *cmd, char if (arm7_9->etm_ctx->trace_depth > 0) { free(arm7_9->etm_ctx->trace_data); + arm7_9->etm_ctx->trace_data = NULL; } arm7_9->etm_ctx->trace_depth = 0; diff --git a/src/target/image.c b/src/target/image.c index 5ecbb81d..a0962b1f 100644 --- a/src/target/image.c +++ b/src/target/image.c @@ -821,6 +821,7 @@ int image_read_section(image_t *image, int section, u32 offset, u32 size, u8 *bu IMAGE_MEMORY_CACHE_SIZE, image_memory->cache) != ERROR_OK) { free(image_memory->cache); + image_memory->cache = NULL; return ERROR_IMAGE_TEMPORARILY_UNAVAILABLE; } image_memory->cache_address = address & ~(IMAGE_MEMORY_CACHE_SIZE - 1); @@ -909,7 +910,10 @@ int image_close(image_t *image) fileio_close(&image_ihex->fileio); if (image_ihex->buffer) + { free(image_ihex->buffer); + image_ihex->buffer = NULL; + } } else if (image->type == IMAGE_ELF) { @@ -918,17 +922,26 @@ int image_close(image_t *image) fileio_close(&image_elf->fileio); if (image_elf->header) + { free(image_elf->header); + image_elf->header = NULL; + } if (image_elf->segments) + { free(image_elf->segments); + image_elf->segments = NULL; + } } else if (image->type == IMAGE_MEMORY) { image_memory_t *image_memory = image->type_private; if (image_memory->cache) + { free(image_memory->cache); + image_memory->cache = NULL; + } } else if (image->type == IMAGE_SRECORD) { @@ -937,7 +950,10 @@ int image_close(image_t *image) fileio_close(&image_mot->fileio); if (image_mot->buffer) + { free(image_mot->buffer); + image_mot->buffer = NULL; + } } else if (image->type == IMAGE_BUILDER) { @@ -946,14 +962,21 @@ int image_close(image_t *image) for (i = 0; i < image->num_sections; i++) { free(image->sections[i].private); + image->sections[i].private = NULL; } } if (image->type_private) + { free(image->type_private); + image->type_private = NULL; + } if (image->sections) + { free(image->sections); + image->sections = NULL; + } return ERROR_OK; } @@ -988,3 +1011,4 @@ int image_calculate_checksum(u8* buffer, u32 nbytes, u32* checksum) return ERROR_OK; } + diff --git a/src/target/trace.c b/src/target/trace.c index 536e34a5..73f01332 100644 --- a/src/target/trace.c +++ b/src/target/trace.c @@ -76,7 +76,7 @@ int handle_trace_point_command(struct command_context_s *cmd_ctx, char *cmd, cha { if (trace->trace_points) free(trace->trace_points); - trace->num_trace_points = 0; + trace->num_trace_points = NULL; trace->trace_points_size = 0; return ERROR_OK; |