[Tile-serving] [osm2pgsql] Conversion to C++ (#187)

Paul Norman notifications at github.com
Wed Oct 15 04:27:50 UTC 2014


> +        if ((nsql = (char *)realloc (sql, size)) == NULL) {
> +            free(sql);
> +            throw std::runtime_error("Memory re-allocation failed in pgsql_exec");
> +        } else {
> +            sql = nsql;
> +        }
> +    }
> +
> +#ifdef DEBUG_PGSQL
> +    fprintf( stderr, "Executing: %s\n", sql );
> +#endif
> +    PGresult* res = PQexec(sql_conn, sql);
> +    if (PQresultStatus(res) != expect) {
> +        free(sql);
> +        PQclear(res);
> +        throw std::runtime_error((boost::format("%1% failed: %2%") % sql % PQerrorMessage(sql_conn)).str());

We've called `free(sql)` above, but try to substitute it in here. Not actually too serious a bug, as we only get to this code if we're going to throw a runtime error and exit the program anyways

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


More information about the Tile-serving mailing list