Stack memory is local to functions; heap memory is allocated manually via `malloc` / `calloc` and must be freed with `free`. Failing to free causes memory leaks; using freed pointers causes Use-After-Free vulnerabilities.
c
int *arr = (int *)malloc(10 * sizeof(int));
if (!arr) { /* handle out of memory */ }
free(arr);
arr = NULL;