In order to produce a code with high quality and high reliability, a static pointer dereference checking method was presented, and the definition of the finite-state machine for pointer-state transition was given. The point-to information was gotten and the mapping relationship between pointer and memory unit was built through semantic analysis of source codes to judge whether it was legal to use the pointer according to the pointer-state in the finite-state machine. This method not only recorded the scope and pointer sets of the variable, but also analyzed point-to including the definite and the possible. And the method of delayed writing point-to to partial control blocks was applied to increase the efficiency of pointer dereference analysis and to detect the problem of the bad deallocation. Results of experimentation showed that this method can detect invalid pointer dereference and bad deallocation effectively.