halide/Halide — pull request #338 by jrprice (2014-06-13 11:14:38+00:00)
Title: Fixed bug where GPU module state was not added to state list.

This fixes a bug in the changes I made a while back to keep track of GPUs modules attached to a context (PR #238). The second time a module is initialised, the module was not being added to the state list, which meant that it was not being released properly.

I've also made it so that the state allocation only happens if module creation is successful, to avoid memory leaks from repeated unsuccessful initialisation attempts (not that this is likely to occur in practice).