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>
This commit is contained in:
parent
884ca45613
commit
a71bfb4a6a
|
@ -345,10 +345,10 @@ int main(int argc, char **argv)
|
||||||
|
|
||||||
error_close_buffer_access:
|
error_close_buffer_access:
|
||||||
close(fp);
|
close(fp);
|
||||||
error_free_data:
|
|
||||||
free(data);
|
|
||||||
error_free_buffer_access:
|
error_free_buffer_access:
|
||||||
free(buffer_access);
|
free(buffer_access);
|
||||||
|
error_free_data:
|
||||||
|
free(data);
|
||||||
error_free_buf_dir_name:
|
error_free_buf_dir_name:
|
||||||
free(buf_dir_name);
|
free(buf_dir_name);
|
||||||
error_free_triggername:
|
error_free_triggername:
|
||||||
|
|
Loading…
Reference in New Issue