martanne / dvtm

dvtm brings the concept of tiling window management, popularized by X11-window managers like dwm to the console. As a console window manager it tries to make it easy to work with multiple console based programs.
MIT License
848 stars 105 forks source link

Fix minor memory leak in command line parsing #76

Closed MarSoft closed 3 years ago

MarSoft commented 6 years ago

realpath(..., NULL) allocates buffer of size MAX_PATH bytes. Then, setenv() copies the string it got (unlike putenv()). So we should free this string, or else it is leaked.

Found this issue while trying to debug #74 with Valgrind. That 4096-bytes memory block was marked as "definitely lost".

rpmohn commented 6 years ago

Also requires that you remove the "const" designation, right?

-  const char *fifo;
+  char *fifo;