I hope that you are using
git for version-control, even on "your own personal" project, because this will give you the opportunity to definitively see ... "what changed recently?" And, to see
exactly what each and every change consisted of.
Most probably, there's a point in time at which "you thought that the program worked," and another point in time at which "you noticed the bug." Take a look at the most-recent changes.
A few other tips, all of which go back to "coding discipline" ...
- Always allocate storage blocks with calloc or some other means of initializing every block to known all-zeros.
- When you deallocate something, immediately in the next statement set all associated pointers to NULL.
- Write test-scripts to independently exercise all major pieces of the program in isolation to the others. Run these tests all the time to catch regressions.
- Use debugging-tools that add "eyecatchers" around storage-blocks to detect "off-by-one" overwrites and other similar problems. Consider leaving them in in the production(!) code.