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

Fix memory leak of ext_host_name in ssl_ext structure #49

Closed
wants to merge 3 commits into from
Closed

Fix memory leak of ext_host_name in ssl_ext structure #49

wants to merge 3 commits into from

Commits on Jun 19, 2017

  1. Save ~3KB by moving strings out of RODATA

    Constant text strings actually take up SRAM space on the ESP8266
    because the .RODATA segment must be copied to RAM at startup since
    FLASH isn't byte-accessible.
    
    Move the constant format strings in a printf completely into FLASH
    and add a wrapper to copy it into a local stack-allocated space
    when needed, freeing up about 3100 bytes of RAM for use.  This doesn't
    make FLASH usage any higher, either, since those strings were already
    being stored there (but never used after the power-on startup code).
    
    Minor edits required in some of the output/debug/tracing functions,
    but no logic changed.
    earlephilhower committed Jun 19, 2017
    Configuration menu
    Copy the full SHA
    bc27f4b View commit details
    Browse the repository at this point in the history

Commits on Jul 21, 2017

  1. Configuration menu
    Copy the full SHA
    c99d259 View commit details
    Browse the repository at this point in the history
  2. Fix memory leak of ext_host_name

    ssl_ext has a hostname which is strdup()'d (i.e. allocated) but wasn't
    freed in the ssl_ext_free() routine.  This lead to the leaking of that
    strdup()'d pointer on every SSL close/reopen cycle.
    
    Patch simply checks if there's a string and frees it in the ssl_ext_free
    routine.  Also adds a sanity check in set_ext_hostname() to not try and
    free() the old string if there is not one present.
    earlephilhower committed Jul 21, 2017
    Configuration menu
    Copy the full SHA
    abe2318 View commit details
    Browse the repository at this point in the history