Check memory allocation

"responses" is dereferenced later on, so could crash if this mem allocation fails

Also initialize local variables