mirror of
https://github.com/profanity-im/profanity.git
synced 2024-12-04 14:46:46 -05:00
Fix string frees in _complete_filepath
This commit is contained in:
parent
2613d23f8b
commit
74148dd6a2
@ -3003,25 +3003,21 @@ _complete_filepath(const char *const input, char *const startstr)
|
|||||||
if (output_off) {
|
if (output_off) {
|
||||||
if (asprintf(&tmp, "%s/%s", directory, dir->d_name) == -1) {
|
if (asprintf(&tmp, "%s/%s", directory, dir->d_name) == -1) {
|
||||||
free(foofile);
|
free(foofile);
|
||||||
free(directory);
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
if (asprintf(&acstring, "~/%s", tmp+output_off) == -1) {
|
if (asprintf(&acstring, "~/%s", tmp+output_off) == -1) {
|
||||||
free(foofile);
|
free(foofile);
|
||||||
free(directory);
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
free(tmp);
|
free(tmp);
|
||||||
} else if (strcmp(directory, "/") == 0) {
|
} else if (strcmp(directory, "/") == 0) {
|
||||||
if (asprintf(&acstring, "/%s", dir->d_name) == -1) {
|
if (asprintf(&acstring, "/%s", dir->d_name) == -1) {
|
||||||
free(foofile);
|
free(foofile);
|
||||||
free(directory);
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (asprintf(&acstring, "%s/%s", directory, dir->d_name) == -1) {
|
if (asprintf(&acstring, "%s/%s", directory, dir->d_name) == -1) {
|
||||||
free(foofile);
|
free(foofile);
|
||||||
free(directory);
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3030,9 +3026,10 @@ _complete_filepath(const char *const input, char *const startstr)
|
|||||||
}
|
}
|
||||||
closedir(d);
|
closedir(d);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
free(directory);
|
||||||
}
|
}
|
||||||
free(foofile);
|
free(foofile);
|
||||||
free(directory);
|
|
||||||
|
|
||||||
result = autocomplete_param_with_ac(input, startstr, filepath_ac, TRUE);
|
result = autocomplete_param_with_ac(input, startstr, filepath_ac, TRUE);
|
||||||
if (result) {
|
if (result) {
|
||||||
|
Loading…
Reference in New Issue
Block a user