Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong coding style #506

Open
watiko opened this issue Nov 29, 2015 · 1 comment
Open

Wrong coding style #506

watiko opened this issue Nov 29, 2015 · 1 comment

Comments

@watiko
Copy link

watiko commented Nov 29, 2015

v7.4.785...v7.4.790

  • 7.4.786 : it is not possible for a plugin to adjust to a changed setting
  • 7.4.787 : (after 7.4.786) snprintf() isn't available everywhere
  • 7.4.788 : (after 7.4.786) can't build without the crypt feature
  • 7.4.789 : (after 7.4.788) using freed memory and crash
  • 7.4.790 : (after 7.4.786) test fails without the autochdir feature

There are still mixed sprintf and vim_snprintf cases.
https://github.com/vim/vim/blob/v7.4.943/src/option.c#L4979
https://github.com/vim/vim/blob/v7.4.943/src/option.c#L5808

We does not use the last allocated byte of buf_old and buf_new.
EDIT: And Should we use NUMBUFLEN?

    char_u buf_old[11], buf_new[11], buf_type[7];
    vim_snprintf((char *)buf_old, 10, "%ld", old_value);
    vim_snprintf((char *)buf_new, 10, "%ld", value);

https://github.com/vim/vim/blob/v7.4.943/src/option.c#L8957-L8959

EDIT2
If errmsg equals NULL, saved_origval won't be freed (memory leaking).
https://github.com/vim/vim/blob/v7.4.943/src/option.c#L4955-L4991

@watiko
Copy link
Author

watiko commented Dec 13, 2015

a988496 fixes the memory leak.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant