summaryrefslogtreecommitdiff
path: root/src/target/image.c
diff options
context:
space:
mode:
authoroharboe <oharboe@b42882b7-edfa-0310-969c-e2dbd0fdcd60>2008-11-19 07:32:30 +0000
committeroharboe <oharboe@b42882b7-edfa-0310-969c-e2dbd0fdcd60>2008-11-19 07:32:30 +0000
commitcb434c21af5066899c5013a3a3490471f91d4b43 (patch)
treec56fed8b8b8e4f018d2461a9698243e8cc756a72 /src/target/image.c
parent6c15861bd8bd49504c634cb52316cb085056eefc (diff)
downloadopenocd+libswd-cb434c21af5066899c5013a3a3490471f91d4b43.tar.gz
openocd+libswd-cb434c21af5066899c5013a3a3490471f91d4b43.tar.bz2
openocd+libswd-cb434c21af5066899c5013a3a3490471f91d4b43.tar.xz
openocd+libswd-cb434c21af5066899c5013a3a3490471f91d4b43.zip
error checking - no reported errors, but catched a couple of exit()'s and converted them to errors.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1175 b42882b7-edfa-0310-969c-e2dbd0fdcd60
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;
}