fix overwriting of still-needed value (refs #487)

this fixes a bug that was introduced in blackmagic PR #475 which lead to
firmware crashes when connecting to a BMP more than once without a
power-cycle.
This commit is contained in:
David R. Piegdon 2019-06-24 02:25:36 +00:00 committed by UweBonnes
parent 589d297d20
commit 02b2fdb2ae
1 changed files with 3 additions and 2 deletions

View File

@ -110,8 +110,9 @@ void target_add_commands(target *t, const struct command_s *cmds, const char *na
}
if (t->commands) {
for (tc = t->commands; tc->next; tc = tc->next);
tc->next = tc;
struct target_command_s *tail;
for (tail = t->commands; tail->next; tail = tail->next);
tail->next = tc;
} else {
t->commands = tc;
}