jgarff/rpi_ws281x — pull request #13 by TwP (2014-12-19 14:39:00+00:00)
Title: Set freed pointers to NULL

Calling the `ws2811_cleanup` method more than once results in a segmentation fault. This situation can arise if the library is used without sufficient privileges to access the DMA space via `/dev/mem`. When the `ws2811_init` method fails it will (in some instances) invoke `ws2811_cleanup`. If the user then calls `ws2811_fini` before exiting the program a segmentation fault results.

The `ws2811_cleanup` code already checks for a `NULL` pointer before calling `free` on the memory. This change just sets pointers to `NULL` *after* free has been called. This allows `ws2811_cleanup` to be called multiple times without incident.