]> Sergey Matveev's repositories - nnn.git/commitdiff
Fix double free when starting in list mode
authorArun Prakash Jana <engineerarun@gmail.com>
Tue, 5 May 2020 18:05:14 +0000 (23:35 +0530)
committerArun Prakash Jana <engineerarun@gmail.com>
Tue, 5 May 2020 18:05:14 +0000 (23:35 +0530)
src/nnn.c

index 13d9815cb9c5da05870c08fd0e7caf57ffd3723c..069599b3e18a4dfbf45d8e1f88a23a5f31d1d9f9 100644 (file)
--- a/src/nnn.c
+++ b/src/nnn.c
@@ -4236,7 +4236,9 @@ static void rmlistpath()
                DPRINTF_S(__FUNCTION__);
                DPRINTF_S(listpath);
                spawn("rm -rf", listpath, NULL, NULL, F_NOTRACE | F_MULTI);
-               free(listpath);
+               /* Do not free if program was started in list mode */
+               if (listpath != initpath)
+                       free(listpath);
                listpath = NULL;
        }
 }