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

Memory leak in log_printf (when printing exactly 64 characters plus trailing \0) #2232

Closed
felixstorm opened this issue Dec 22, 2018 · 0 comments

Comments

@felixstorm
Copy link
Contributor

felixstorm commented Dec 22, 2018

Same problem as reported (and fixed) here: #2201

Buffer is being allocated if vsnprintf reports 64 or more characters (due to the trailing \0):

if(len >= sizeof(loc_buf)){
temp = (char*)malloc(len+1);

But the buffer is only being released if more than 64 characters had been reported by vsnprintf:
if(len > 64){
free(temp);

Probably related: #2033 (happens only when debug is on and free heap drops by 64 bytes each time)

Code to reproduce:

log_printf("1234567890123456789012345678901234567890123456789012345678901234");
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