Commit 2e75c227 authored by Benno Schulenberg's avatar Benno Schulenberg
Browse files

browser: fix a memory leak

No related merge requests found
Showing with 4 additions and 3 deletions
+4 -3
......@@ -380,12 +380,13 @@ char *do_browse_from(const char *inpath)
path = mallocstrassn(path, striponedir(path));
if (stat(path, &st) == -1 || !S_ISDIR(st.st_mode)) {
free(path);
char * currentdir = charalloc(PATH_MAX + 1);
path = charalloc(PATH_MAX + 1);
path = getcwd(path, PATH_MAX + 1);
free(path);
path = getcwd(currentdir, PATH_MAX + 1);
if (path == NULL) {
free(currentdir);
statusline(MILD, "The working directory has disappeared");
beep();
napms(1200);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment