summaryrefslogtreecommitdiff
path: root/tools/iio
diff options
context:
space:
mode:
authorHartmut Knaack <knaack.h@gmx.de>2015-05-31 15:39:41 +0300
committerJonathan Cameron <jic23@kernel.org>2015-05-31 19:12:51 +0300
commita71bfb4a6aabfe5e6f145883020153103c7fdfba (patch)
tree51cf12fe09b912b8875c43310b6e35e66bf766f4 /tools/iio
parent884ca45613c47efe4b0b1238f6ee677d74fe3419 (diff)
downloadlinux-a71bfb4a6aabfe5e6f145883020153103c7fdfba.tar.xz
tools:iio:generic_buffer: fix order of freeing data
data gets allocated before buffer_access, so it should be freed in reverse order. Otherwise, if allocating buffer_access fails, an attempt to free it would be taken, which should not happen. Signed-off-by: Hartmut Knaack <knaack.h@gmx.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Diffstat (limited to 'tools/iio')
-rw-r--r--tools/iio/generic_buffer.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/tools/iio/generic_buffer.c b/tools/iio/generic_buffer.c
index f805493be3eb..15f2a40c9bf7 100644
--- a/tools/iio/generic_buffer.c
+++ b/tools/iio/generic_buffer.c
@@ -345,10 +345,10 @@ int main(int argc, char **argv)
error_close_buffer_access:
close(fp);
-error_free_data:
- free(data);
error_free_buffer_access:
free(buffer_access);
+error_free_data:
+ free(data);
error_free_buf_dir_name:
free(buf_dir_name);
error_free_triggername: