tests: fix potential memory corruption
authorBartosz Golaszewski <bartekgola@gmail.com>
Thu, 23 Feb 2017 15:03:12 +0000 (16:03 +0100)
committerBartosz Golaszewski <bartekgola@gmail.com>
Thu, 23 Feb 2017 15:03:12 +0000 (16:03 +0100)
commitc65a66036bf30e5766d53ee52da82d6d589ccffe
tree5257d355d14c0ec2ed19d40b54f2638e5c5ceb9c
parent4d4cb8d32db3f947f4e414d692245639b5a2148d
tests: fix potential memory corruption

Valgrind is complaining about invalid reads and writes from the two
line test cases. The culprit is the order in which the cleanup
functions are called.

Declare the chip pointers above the line handles so that we don't
free the resources associated with the chip before releasing the
lines.

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
tests/unit/tests-line.c