Taking a stab at fixing memory leaks