setting pointers to NULL after freeing memory to avoid crashes.
gitignore: only top-level "external" folder is ignored.