Memory Management in C: Best Practices