diff options
author | James Booth <boothj5@gmail.com> | 2016-09-05 23:10:09 +0100 |
---|---|---|
committer | James Booth <boothj5@gmail.com> | 2016-09-05 23:10:09 +0100 |
commit | 74148dd6a23f875f9e6aee9ac01bdad8ccf0f769 (patch) | |
tree | 262070d8eb4fcb94df463211a2597c613ec23c95 /src/command | |
parent | 2613d23f8b33b248dceb91d0ed16e0362a719945 (diff) | |
download | profani-tty-74148dd6a23f875f9e6aee9ac01bdad8ccf0f769.tar.gz |
Fix string frees in _complete_filepath
Diffstat (limited to 'src/command')
-rw-r--r-- | src/command/cmd_ac.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/src/command/cmd_ac.c b/src/command/cmd_ac.c index f60619a3..cedcadee 100644 --- a/src/command/cmd_ac.c +++ b/src/command/cmd_ac.c @@ -3003,25 +3003,21 @@ _complete_filepath(const char *const input, char *const startstr) if (output_off) { if (asprintf(&tmp, "%s/%s", directory, dir->d_name) == -1) { free(foofile); - free(directory); return NULL; } if (asprintf(&acstring, "~/%s", tmp+output_off) == -1) { free(foofile); - free(directory); return NULL; } free(tmp); } else if (strcmp(directory, "/") == 0) { if (asprintf(&acstring, "/%s", dir->d_name) == -1) { free(foofile); - free(directory); return NULL; } } else { if (asprintf(&acstring, "%s/%s", directory, dir->d_name) == -1) { free(foofile); - free(directory); return NULL; } } @@ -3030,9 +3026,10 @@ _complete_filepath(const char *const input, char *const startstr) } closedir(d); } + } else { + free(directory); } free(foofile); - free(directory); result = autocomplete_param_with_ac(input, startstr, filepath_ac, TRUE); if (result) { |