We present an algorithm for the identification of transient noise artifacts (glitches) in cross-correlation searches for long gravitational-wave (GW) transients lasting seconds to weeks. The algorithm utilizes the auto-power in each detector as a discriminator between well-behaved stationary noise (possibly including a GW signal) and non-stationary noise transients. We test the algorithm with both Monte Carlo noise and time-shifted data from the LIGO S5 science run and find that it removes a significant fraction of glitches while keeping the vast majority (99.6%) of the data. We show that this cleaned data can be used to observe GW signals at a significantly lower amplitude than can otherwise be achieved. Using an accretion disk instability signal model, we estimate that the algorithm is accidentally triggered at a rate of less than 10 5% by realistic signals, and less than 3% even for exceptionally loud signals. We conclude that the algorithm is a safe and effective method for cleaning the cross-correlation data used in searches for long GW transients.