aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Arun Prakash Jana <engineerarun@gmail.com>2020-05-05 23:35:14 +0530
committerGravatar Arun Prakash Jana <engineerarun@gmail.com>2020-05-05 23:35:14 +0530
commit4c18f2258782c91b894055f0a4977700717599de (patch)
tree1ed47ac166786a0eb39f622581aecdcb7009212a
parenta563c1a5539ea2187d087b34240cd31ad6a217f5 (diff)
downloadnnn-4c18f2258782c91b894055f0a4977700717599de.tar.gz
Fix double free when starting in list mode
-rw-r--r--src/nnn.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/nnn.c b/src/nnn.c
index 13d9815..069599b 100644
--- 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;
}
}