[Tile-serving] [osm2pgsql] Scan build analysis fixes (#424)

Sarah Hoffmann notifications at github.com
Mon Aug 3 19:09:37 UTC 2015


>  {
>    if( Proj >= 0 )
> -    return &Projection_Infos[Proj];
> +    return std::make_shared<const Projection_Info>(Projection_Infos[Proj]);

You are wrapping a pointer to static data in a shared pointer here. That's bad as it will call delete on it as soon as the pointer goes out of scope. shared_ptr is overkill here anyways as the projection info is never really shared with objects (the pointer is never saved anywhere else). Use a unique_ptr below and just return a raw pointer here as before. Or even better: replace project_getprojinfo() with a get_srs() and get_proj_desc() function. 

---
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/osm2pgsql/pull/424/files#r36119407
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/tile-serving/attachments/20150803/cb21285a/attachment.html>


More information about the Tile-serving mailing list