Avoid memory leak caused by pointer re-assign

类别:编程语言 点击:0 评论:0 推荐:

There are more than 2 millions lines of C code of our communicational device embedded software. All these codes are well tested through IT(Integrated Test) and ST(System Test). But, there are memory leaks caused by foolish programming mistakes. Last month, I fixed a fatal bug with memory leak problem, and at last, I found it was caused by pointer re-assigned, a pointer is set to a new position without buffer its old memory block.The simple resolution is to use a buffer to save and restore before and after using the pointer.

本文地址:http://com.8s8s.com/it/it23456.htm