I have a program and when I input wrong data from the keyboard it just exits with exit(1).
I was testing with Valgrind and while this happens there are
In the end, the OS will take care of it (on every modern OS, it was not the case with older version of Windows). Every ressource used by your program (memory, open file descriptors, ...) will be reclaimed by the OS when the program terminate (except some resource that are designed to survive process termination, mainly some sort of shared memory / mutex).
However, valgrind is here to help you track memory leak and will report every available memory region so that you can, if you want, manually release them.