error handling- almost

*the function newButtonGeneric frees the whole list in case of failure
*in your VS version the might be problems with free. please check