summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAntonio Borneo <borneo.antonio@gmail.com>2010-10-12 16:08:35 +0800
committerØyvind Harboe <oyvind.harboe@zylin.com>2010-10-12 11:22:26 +0200
commit2ee47b22c6228b80c5a8f1e74209cbf7ad53f775 (patch)
tree70f2c6952b71907a95062bc6d25689c2e685e9ad /src
parente3773e3e3d1f1ee0dbb0b69e8babe8419784d1c1 (diff)
downloadopenocd+libswd-2ee47b22c6228b80c5a8f1e74209cbf7ad53f775.tar.gz
openocd+libswd-2ee47b22c6228b80c5a8f1e74209cbf7ad53f775.tar.bz2
openocd+libswd-2ee47b22c6228b80c5a8f1e74209cbf7ad53f775.tar.xz
openocd+libswd-2ee47b22c6228b80c5a8f1e74209cbf7ad53f775.zip
TARGET: fix segfault in handle_dump_image_command()
The struct fileio is used after fileio_close(). Move fileio_close() after last usage. Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Diffstat (limited to 'src')
-rw-r--r--src/target/target.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/target/target.c b/src/target/target.c
index 82cbbff5..3c85502e 100644
--- a/src/target/target.c
+++ b/src/target/target.c
@@ -2643,9 +2643,6 @@ COMMAND_HANDLER(handle_dump_image_command)
address += this_run_size;
}
- if ((retvaltemp = fileio_close(&fileio)) != ERROR_OK)
- return retvaltemp;
-
if ((ERROR_OK == retval) && (duration_measure(&bench) == ERROR_OK))
{
int filesize;
@@ -2657,6 +2654,9 @@ COMMAND_HANDLER(handle_dump_image_command)
duration_elapsed(&bench), duration_kbps(&bench, filesize));
}
+ if ((retvaltemp = fileio_close(&fileio)) != ERROR_OK)
+ return retvaltemp;
+
return retval;
}