iter: fix a crash occurring if no GPIO chips are present
authorBartosz Golaszewski <bartekgola@gmail.com>
Sun, 5 Nov 2017 20:04:52 +0000 (21:04 +0100)
committerBartosz Golaszewski <bartekgola@gmail.com>
Sun, 5 Nov 2017 20:04:52 +0000 (21:04 +0100)
commitf4c15c32ac3b87e1c41534735d91f0f65165bf7e
tree15c3a5deabf751a7547c05c452b0499158911819
parentdfe98084e2641d49eed7d8d5203089031a819632
iter: fix a crash occurring if no GPIO chips are present

If no GPIO chips are present in the system, we bail out from
gpiod_chip_iter_new() before allocating the chips array. Add a check
in gpiod_chip_iter_free() to avoid calling free() for iter->chips in
that case.

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
src/lib/iter.c