mirror of
https://git.jabber.space/devs/cproof.git
synced 2026-07-18 11:56:22 +00:00
Free strings in _complete_filepath
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user