This PR adds out-of-memory checks to quickfix.c in functions qf_get_fnum() and qf_push_dir().
Cheers
John
https://github.com/vim/vim/pull/19528
(1 file)
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
@chrisbra commented on this pull request.
In src/quickfix.c:
> @@ -2823,6 +2825,8 @@ qf_push_dir(char_u *dirbuf, struct dir_stack_T **stackptr, int is_file_stack) vim_free((*stackptr)->dirname); (*stackptr)->dirname = concat_fnames(ds_new->dirname, dirbuf, TRUE); + if ((*stackptr)->dirname == NULL) + return NULL;
Isn't this part leaking memory? I think it should be similar to this:
if ((*stackptr)->dirname == NULL)
{
vim_free(ds_new->dirname);
vim_free(ds_new);
return NULL;
}
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
@basilisk0315 commented on this pull request.
In src/quickfix.c:
> @@ -2823,6 +2825,8 @@ qf_push_dir(char_u *dirbuf, struct dir_stack_T **stackptr, int is_file_stack) vim_free((*stackptr)->dirname); (*stackptr)->dirname = concat_fnames(ds_new->dirname, dirbuf, TRUE); + if ((*stackptr)->dirname == NULL) + return NULL;
I think you're on the right track, but I think more like this:
while (ds_new) { char_u *dirname;
dirname = concat_fnames(ds_new->dirname, dirbuf
, TRUE); if (dirname == NULL) { // pop the new element from the stack and free it ds_ptr = *stackptr; *stackptr = (*stackptr)->next; vim_free(ds_ptr); return NULL; } if (mch_isdir(dirname) == TRUE) { vim_free((*stackptr)->dirname); (*stackptr)->dirname = dirname; break; } ds_new = ds_new->next; }
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
@basilisk0315 pushed 1 commit.
—
View it on GitHub or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
alright, thanks
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()