Opened 15 years ago

Closed 14 years ago

#961 closed Defect (fixed)

Memory leak in coproc code

Reported by: Nicolas Owned by:
Priority: Minor Milestone: Undetermined
Component: Undetermined Version: 6.10.17
Keywords: cppcheck leak Cc: chris@…

Description

In coproc.cpp line 192:

        if (strstr(buf, "<coproc_cuda>")) {
            COPROC_CUDA* cc = new COPROC_CUDA;
            int retval = cc->parse(fin);
            if (!retval) {
                coprocs.push_back(cc);
            }
        }

If cc->parse fails, the COPROC_CUDA doesn't get added to the coprocs container, but it's not freed either. In line 198, it goes out of scope, and leaks.

Same a few lines below with COPROC_ATI (thanks to code duplication).

[found with cppcheck]

Change History (1)

comment:1 Changed 14 years ago by cli

Cc: chris@… added
Resolution: fixed
Status: newclosed

This particular code has been rewritten to avoid the dynamic allocation of COPROC_* 

Note: See TracTickets for help on using tickets.