I'm writing a simple shell as an OS course assignment, I need to search in the PATH to find the program user typed in, once I find the right directory, I malloc a piece of memory just enough to hold the directory name plus the program name, and I pass it as the first argument to execv().
I could have statically allocated 100 characters or so, but having a limit makes me feel uncomfortable. So when execv() executes, is the heap cleaned up or is that piece of memory lost?
It's maybe not a lot of memory but I'm just curious.