Shortening the lifecycle of heap objects lets the allocator reclaim memory faster, and allows it to be quickly reused for new heap objects, which reduces the amount of heap memory required.
p=(type *)malloc(sizeof(type)); do_something(p); free(p); p=NULL; do_something_else();
After the pointer is used, it is freed, then nullified. The memory can then be used by other processes. In addition, try to avoid creating aliases for heap variables because it usually makes code less readable, more error prone, and difficult to analyze.