Efficient and linear static approach for finding the memory leak in C

Vishruti Desai, Vivaksha Jariwala

Abstract


Code analysis has discovered that memory leaks are common in the C programming language. In literature, there exist various approaches for statically analyzing and detecting memory leaks. The complexity and diversity of memory leaks make it difficult to find an approach that is both effective and simple. In embedded systems, costly resources like memory become limited as the system's size diminishes. As a result, memory must be handled effectively and efficiently too. To obtain precise analysis, we propose a novel approach that works in a phase-wise manner. Instead of examining all possible paths for finding memory leaks, we use a program slicing to check for a potential memory leak. We introduce a source-sink flow graph (SSFG) based on source-sink properties of memory allocation-deallocation within the C code. To achieve simplicity in analysis, we also reduce the complexity of analysis in linear time. In addition, we utilize a constraint solver to improve the effectiveness of our approach. To evaluate the approach, we perform manual scanning on various test cases: link list applications, Juliet test cases, and Common Vulnerabilities and Exposures found in 2021. The results show the efficiency of the proposed approach by preparing the SSFG with linear complexity.

Keywords


embedded system; memory leak; sparse value flow; static analysis;

Full Text:

PDF


DOI: http://doi.org/10.11591/ijece.v13i2.pp1932-1942

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.

International Journal of Electrical and Computer Engineering (IJECE)
p-ISSN 2088-8708, e-ISSN 2722-2578