In the inertial sensing unit based indoor positioning systems, the gyroscope drift is the primary source of heading error. To reduce this error, we proposed that the heading drift and the real heading change can be distinguished by the similarity of the gait pattern in the same movement model. It use the curve fitting method to find out the gait pattern in walking straightly. The Frechet distance is used to discriminate the gait of walking in turn and walking straightly. Experiments show that this method can recognize the walking in turn successfully with no mistake and the rate of mismatch walking in straight to walking in turn is less than 17.39%. Although there are some mistakes of match the walking in straight to walking in turn model, it will have few impact because heading drift is little in a short time. The result of test two shows that it get the best result compared with the other two methods when doing heading correction. It indicates that the proposal can promote the performance of heading correction and reduce the effect of sensor drift.