stdcxx-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Farid Zaripov (JIRA)" <j...@apache.org>
Subject [jira] Commented: (STDCXX-577) purify reports leaked memory in stocks example
Date Fri, 05 Oct 2007 12:43:50 GMT

    [ https://issues.apache.org/jira/browse/STDCXX-577?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12532644
] 

Farid Zaripov commented on STDCXX-577:
--------------------------------------

There left some leaks, if std::setlocale() fails, the xxxXchange facets will not be deleted.

The following fragments:
-------
    const char *p = std::setlocale (LC_ALL, US_LOCALE);
    if (!p)
        std::cerr << "\nNot a valid locale: " << US_LOCALE << '\n';
-------

need to replace to:
-------
    const char *p = std::setlocale (LC_ALL, US_LOCALE);
    if (!p) {
        std::cerr << "\nNot a valid locale: " << US_LOCALE << '\n';
        delete nse;
    }
-------


> purify reports leaked memory in stocks example 
> -----------------------------------------------
>
>                 Key: STDCXX-577
>                 URL: https://issues.apache.org/jira/browse/STDCXX-577
>             Project: C++ Standard Library
>          Issue Type: Improvement
>          Components: Examples
>            Reporter: Travis Vitek
>            Assignee: Travis Vitek
>             Fix For: 4.2.1
>
>         Attachments: stdcxx-577.patch, stocks.log
>
>
> It is pretty obvious from looking at the source that memory is being leaked. The destructor
for StockXchange doesn't deallocate memory allocated in StockXchange::add(), and the sl_pairs
allocated in main are never deallocated.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message