summaryrefslogtreecommitdiff
path: root/src/target/image.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/target/image.c')
-rw-r--r--src/target/image.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/target/image.c b/src/target/image.c
index a8753ac9..e7b7067d 100644
--- a/src/target/image.c
+++ b/src/target/image.c
@@ -718,6 +718,13 @@ int image_open(image_t *image, char *url, char *type_string)
}
else if (image->type == IMAGE_MEMORY)
{
+ target_t *target = get_target_by_num(strtoul(url, NULL, 0));
+ if (target==NULL)
+ {
+ LOG_ERROR("Target '%s' does not exist", url);
+ return ERROR_FAIL;
+ }
+
image_memory_t *image_memory;
image->num_sections = 1;
@@ -728,7 +735,7 @@ int image_open(image_t *image, char *url, char *type_string)
image_memory = image->type_private = malloc(sizeof(image_memory_t));
- image_memory->target = get_target_by_num(strtoul(url, NULL, 0));;
+ image_memory->target = target;
image_memory->cache = NULL;
image_memory->cache_address = 0x0;
}