Changeset d7d63e5 for src


Ignore:
Timestamp:
Aug 6, 2018, 10:49:15 AM (6 years ago)
Author:
Rob Schluntz <rschlunt@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, no_list, persistent-indexer, pthread-emulation, qualifiedEnum
Children:
5e44ac2
Parents:
8316a49
Message:

Handle memory leaks in cforall_demangle

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/SymTab/Demangle.cc

    r8316a49 rd7d63e5  
    430430                                if (done()) return nullptr;
    431431                                FunctionType * ftype = new FunctionType( tq, false );
     432                                std::unique_ptr<Type> manager(ftype);
    432433                                Type * retVal = parseType();
    433434                                if (! retVal) return nullptr;
     
    437438                                while (! done()) {
    438439                                        PRINT( std::cerr << "got ch: " << cur() << std::endl; )
    439                                         if (cur() == '_') return ftype;
     440                                        if (cur() == '_') return manager.release();
    440441                                        Type * param = parseType();
    441442                                        if (! param) return nullptr;
     
    452453                                if (! extractNumber(ncomponents)) return nullptr;
    453454                                for (size_t i = 0; i < ncomponents; ++i) {
     455                                        // TODO: delete all on return
    454456                                        if (done()) return nullptr;
    455457                                        PRINT( std::cerr << "got ch: " << cur() << std::endl; )
     
    515517                                Type * type = nullptr;
    516518                                if (! view.parse(name, type)) return mangleName;
     519                                std::unique_ptr<Type> manager(type);
    517520                                return genDemangleType(type, name);
    518521                        }
Note: See TracChangeset for help on using the changeset viewer.