noice.c | 6 ++++-- diff --git a/noice.c b/noice.c index 4626286edd4f51c400e14bbf0ec7833b7eaed164..1d0a0c96da9557d3b0956b51798b179c8d2254e4 100644 --- a/noice.c +++ b/noice.c @@ -604,8 +604,10 @@ qsort(dents, n, sizeof(*dents), entrycmp); /* Find cur from history */ cur = dentfind(dents, n, path, hpath); - free(hpath); - hpath = NULL; + if (hpath != NULL) { + free(hpath); + hpath = NULL; + } for (;;) { int nlines;