Hello,

File ports-foc/src/lib/l4lx/rm.cc, in method  Region_manager::reserve_range I 
see possible resource
leakage:



Region* Region_manager::reserve_range(Genode::size_t size, int align,
                                      Genode::addr_t start)
{
        using namespace Genode;
        void* addr = 0;

        while (true) {

                try {
                        /*
                         * We attach a managed-dataspace as a placeholder to
                         * Genode's region-map
                         */
                        Rm_connection *rmc = new (env()->heap()) 
Rm_connection(0, size);
                        addr = start ? 
env()->rm_session()->attach_at(rmc->dataspace(), start)
                                     : 
env()->rm_session()->attach(rmc->dataspace());
                        //PDBG("attach done addr=%p!", addr);
                        break;
                } catch(Rm_session::Attach_failed e) {
                        PWRN("attach failed start=%lx", start);
                        if (start) /* attach with pre-defined address failed, 
so search one */
                                start = 0;
                        else
                                return 0;
                }
        }

        /*
         * Mark the region reserved, in our region-map by setting the
         * dataspace reference to zero.
         */
        alloc_addr(size, (addr_t)addr);
        Region reg((addr_t)addr, size, 0);
        metadata(addr, reg);
        return metadata(addr);
}

If env()->rm_session()->attach_at or env()->rm_session()->attach throw 
exception (looks, this is normal flow),
then rmc and space, allocated from env()->heap() will be lost, right?

--

With best regards,

  -- ptr

------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_mar
_______________________________________________
Genode-main mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/genode-main

Reply via email to