Leak detection and gas analysis