python / cpython

The Python programming language
https://www.python.org/
Other
60.02k stars 29.05k forks source link

memory leak in floatobject.c #47619

Closed 84401114-8e59-4056-83cb-632106c0b648 closed 15 years ago

84401114-8e59-4056-83cb-632106c0b648 commented 15 years ago
BPO 3369
Nosy @brettcannon, @mdickinson, @kristjanvalur
Files
  • tmp4.patch: patch for issue
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields: ```python assignee = 'https://github.com/mdickinson' closed_at = created_at = labels = ['interpreter-core', 'easy', 'performance'] title = 'memory leak in floatobject.c' updated_at = user = 'https://github.com/kristjanvalur' ``` bugs.python.org fields: ```python activity = actor = 'mark.dickinson' assignee = 'mark.dickinson' closed = True closed_date = closer = 'mark.dickinson' components = ['Interpreter Core'] creation = creator = 'kristjan.jonsson' dependencies = [] files = ['10901'] hgrepos = [] issue_num = 3369 keywords = ['patch', 'easy'] message_count = 4.0 messages = ['69721', '69725', '69830', '70126'] nosy_count = 3.0 nosy_names = ['brett.cannon', 'mark.dickinson', 'kristjan.jonsson'] pr_nums = [] priority = 'normal' resolution = 'fixed' stage = None status = 'closed' superseder = None type = 'resource usage' url = 'https://bugs.python.org/issue3369' versions = ['Python 3.0'] ```

    84401114-8e59-4056-83cb-632106c0b648 commented 15 years ago

    When a nan or inf is generated in PyFloat_FromString(), a temporary buffer may be left behind. Patch attached. Found using Purify

    mdickinson commented 15 years ago

    Does this also apply to 2.6?

    mdickinson commented 15 years ago

    Does this also apply to 2.6?

    Looks like it doesn't. :-).

    The patch needs to touch the newly arrived comparison with "infinity", as well as the "inf" and "nan" comparisons.

    mdickinson commented 15 years ago

    Fixed in r65179. I modified the patch slightly to include the "infinity" check, and to change "if(s_buffer)" to the slightly more explicit "if (s_buffer != NULL)".

    Thanks!