From: Arun Prakash Jana Date: Fri, 12 Apr 2019 14:36:29 +0000 (+0530) Subject: Free readline buffer in corner cases X-Git-Tag: v2.5~120 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=3e4797f7289e16c61cf5af9abdec456e0049c67d;p=nnn.git Free readline buffer in corner cases --- diff --git a/src/nnn.c b/src/nnn.c index 043ee5b5..67ebdf1a 100644 --- a/src/nnn.c +++ b/src/nnn.c @@ -3830,6 +3830,8 @@ nochange: if (chdir(ipath) == -1) { printwarn(); + if (tmp) + free(tmp); goto nochange; } @@ -3839,8 +3841,10 @@ nochange: spawn(shell, "-c", tmp, path, F_CLI); /* readline finishing touches */ add_history(tmp); - free(tmp); } + + if (tmp) + free(tmp); } #endif }