Add check for array destructor

* Check if array destructor is not null before calling.
Add RNG module
Handle default case in set_pixformat
Add checks for NULL return from gc_*