Benjamin Livshits and Thomas Zimmermann
In this chapter we propose an automatic way to extract likely error patterns by mining software revision histories. Moreover, in order to ensure that all the errors we find are relatively easy to confirm and fix, we pay particular attention in our experiments to errors that can be fixed with a one-line change. It is worth pointing out that many well-known error patterns such as memory leaks, double-free's, mismatched locks, open and close operations on operating system resources, buffer overruns, and format string errors can often be addressed with a one-line fix. Looking at incremental changes between revisions as opposed to complete snapshots of the source allows us to better focus our mining strategy and obtain more precise results. Our approach uses revision history information to infer likely error patterns. We then experimentally evaluate the patterns we extracted by checking for them dynamically.