diff --git a/src/target/target.c b/src/target/target.c index 4d277c694..87b3d1cbc 100644 --- a/src/target/target.c +++ b/src/target/target.c @@ -5104,6 +5104,7 @@ static int target_create(Jim_GetOptInfo *goi) target = calloc(1, sizeof(struct target)); /* set target number */ target->target_number = new_target_number(); + cmd_ctx->current_target = target->target_number; /* allocate memory for each unique target type */ target->type = calloc(1, sizeof(struct target_type));