eclipse / mraa

Linux Library for low speed IO Communication in C with bindings for C++, Python, Node.js & Java. Supports generic io platforms, as well as Intel Edison, Intel Joule, Raspberry Pi and many more.
http://mraa.io
MIT License
1.36k stars 613 forks source link

gpio: fix incorrect assignment of *cinfos in mraa_get_chip_infos #1087

Closed fr0st61te closed 2 years ago

fr0st61te commented 2 years ago

cinfos in mraa_get_chip_infos is not set in case of mraa_get_chip_info_by_name failure which happens on access of /dev/gpiochip files which leads to memory free by invalid pointer in cinfos.

As example, it can be easy recreated with non-root run of mraa-gpio:

test@iot2050-debian:~$ mraa-gpio free(): invalid pointer Aborted

The question is, is it right to hide the information about incorrect access to files and just don't show gpio lines? Or is it need to be delivered to end user with information about those files aren't being accessed?

siemens/meta-iot2050#281