summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authoroharboe <oharboe@b42882b7-edfa-0310-969c-e2dbd0fdcd60>2009-09-11 06:58:49 +0000
committeroharboe <oharboe@b42882b7-edfa-0310-969c-e2dbd0fdcd60>2009-09-11 06:58:49 +0000
commit58b78818e00b7518350c7a45474bb00d7584bf6d (patch)
tree2e1d9044355dcef2c336c81ad913830e3932940e /src
parent6dd8f37e6df86578b5805bfff137c7b78d9455f9 (diff)
downloadopenocd+libswd-58b78818e00b7518350c7a45474bb00d7584bf6d.tar.gz
openocd+libswd-58b78818e00b7518350c7a45474bb00d7584bf6d.tar.bz2
openocd+libswd-58b78818e00b7518350c7a45474bb00d7584bf6d.tar.xz
openocd+libswd-58b78818e00b7518350c7a45474bb00d7584bf6d.zip
registering a target event twice caused infinite loop. Same bug as in jtag/core.c copy & pasted.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2690 b42882b7-edfa-0310-969c-e2dbd0fdcd60
Diffstat (limited to 'src')
-rw-r--r--src/target/target.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/target/target.c b/src/target/target.c
index 56e124f7..223a0356 100644
--- a/src/target/target.c
+++ b/src/target/target.c
@@ -2,7 +2,7 @@
* Copyright (C) 2005 by Dominic Rath *
* Dominic.Rath@gmx.de *
* *
- * Copyright (C) 2007,2008 Øyvind Harboe *
+ * Copyright (C) 2007-2009 Øyvind Harboe *
* oyvind.harboe@zylin.com *
* *
* Copyright (C) 2008, Duane Ellis *
@@ -3547,9 +3547,11 @@ static int target_configure(Jim_GetOptInfo *goi, target_t *target)
}
if (goi->isconfigure) {
+ bool replace = true;
if (teap == NULL) {
/* create new */
teap = calloc(1, sizeof(*teap));
+ replace = false;
}
teap->event = n->value;
Jim_GetOpt_Obj(goi, &o);
@@ -3569,9 +3571,12 @@ static int target_configure(Jim_GetOptInfo *goi, target_t *target)
*/
Jim_IncrRefCount(teap->body);
- /* add to head of event list */
- teap->next = target->event_action;
- target->event_action = teap;
+ if (!replace)
+ {
+ /* add to head of event list */
+ teap->next = target->event_action;
+ target->event_action = teap;
+ }
Jim_SetEmptyResult(goi->interp);
} else {
/* get */