summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authoroharboe <oharboe@b42882b7-edfa-0310-969c-e2dbd0fdcd60>2008-06-25 19:23:55 +0000
committeroharboe <oharboe@b42882b7-edfa-0310-969c-e2dbd0fdcd60>2008-06-25 19:23:55 +0000
commitc5df3ce144d27babd555da1a3bedded474de7bd0 (patch)
tree9d91640ed7e8ed51ddf97e7f5fd22cc9d677f015 /src
parentc152c6a5ed015f56aa6c8f83573f2b1980b332b1 (diff)
downloadopenocd+libswd-c5df3ce144d27babd555da1a3bedded474de7bd0.tar.gz
openocd+libswd-c5df3ce144d27babd555da1a3bedded474de7bd0.tar.bz2
openocd+libswd-c5df3ce144d27babd555da1a3bedded474de7bd0.tar.xz
openocd+libswd-c5df3ce144d27babd555da1a3bedded474de7bd0.zip
Fixed bogus error message and plugged memory leak for the case when there was no reset script.
git-svn-id: svn://svn.berlios.de/openocd/trunk@728 b42882b7-edfa-0310-969c-e2dbd0fdcd60
Diffstat (limited to 'src')
-rw-r--r--src/target/target.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/target/target.c b/src/target/target.c
index 91fdd9ea..1be4885d 100644
--- a/src/target/target.c
+++ b/src/target/target.c
@@ -217,6 +217,8 @@ target_t* get_current_target(command_context_t *cmd_ctx)
static void execute_script(struct command_context_s *cmd_ctx, char *reset_script)
{
+ if (reset_script==NULL)
+ return;
FILE *script;
script = open_file_from_path(reset_script, "r");
if (!script)
@@ -237,7 +239,7 @@ int target_init_handler(struct target_s *target, enum target_event event, void *
{
struct command_context_s *cmd_ctx = priv;
- if ((event == TARGET_EVENT_HALTED) && (target->reset_script))
+ if (event == TARGET_EVENT_HALTED)
{
target_unregister_event_callback(target_init_handler, priv);