diff options
author | James Booth <boothj5@gmail.com> | 2016-09-05 22:27:30 +0100 |
---|---|---|
committer | James Booth <boothj5@gmail.com> | 2016-09-05 22:27:30 +0100 |
commit | 9e59571f840ea13aadd2774dc330a62c9749a242 (patch) | |
tree | d8f764b3c6b21f1945f7b71f60d70db3cef1e697 | |
parent | c908f37a2352876549ec358450bf79a0a12f1565 (diff) | |
download | profani-tty-9e59571f840ea13aadd2774dc330a62c9749a242.tar.gz |
Free strings in _complete_filepath
-rw-r--r-- | src/command/cmd_ac.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/command/cmd_ac.c b/src/command/cmd_ac.c index 6bab07ce..f60619a3 100644 --- a/src/command/cmd_ac.c +++ b/src/command/cmd_ac.c @@ -3002,18 +3002,26 @@ _complete_filepath(const char *const input, char *const startstr) char * acstring; 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; } } @@ -3022,10 +3030,9 @@ _complete_filepath(const char *const input, char *const startstr) } closedir(d); } - } else { - free(foofile); - free(directory); } + free(foofile); + free(directory); result = autocomplete_param_with_ac(input, startstr, filepath_ac, TRUE); if (result) { |