Skip to content

Static date header#265

Open
YggdrasiI wants to merge 2 commits intodavidmoreno:masterfrom
YggdrasiI:static_date_header
Open

Static date header#265
YggdrasiI wants to merge 2 commits intodavidmoreno:masterfrom
YggdrasiI:static_date_header

Conversation

@YggdrasiI
Copy link
Contributor

This is a proposal to fix #254 .
It just converts the storage for the date header into a fixed array. So, valgrind does not complain about the non-freed array at program end.
The change doesn't release us from using the locking around reading/writing the date_header.

Reason for the change: The latest allocation of 'onion_response_last_date_header'
in response.c will never free'd.

Solution: Change 'onion_response_last_date_header' into static array
and change strdup() by memcpy() call.
Moreover, only one of the competing threads 'with a new header string'
will overwrites 'onion_response_last_date_header'.
This string will hold a localized timestamp, but 200 seems
too pessimistic?!
(Multi-byte characters made it hard to estimate the lowest bound,
but for the current strftime pattern all values > 64 seems big enough. )
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

Successfully merging this pull request may close these issues.

libonion leaks 31 bytes in all programs

1 participant