[postgis-devel] [postgis-tickets] r15723 - #3847, coverity fixes in topology and address standardizer

Sandro Santilli strk at kbt.io
Thu Sep 14 07:19:56 PDT 2017


On Thu, Sep 14, 2017 at 06:56:57AM -0700, Paul Ramsey wrote:
> Author: pramsey
> Date: 2017-09-14 06:56:57 -0700 (Thu, 14 Sep 2017)
> New Revision: 15723
> 
> Modified:
>    trunk/extensions/address_standardizer/gamma.c
>    trunk/topology/postgis_topology.c
> Log:
> #3847, coverity fixes in topology and address standardizer
> 

The change below seems to be calling SPI_prepare on each and every
call (previously it was only called on first invocation).

> Modified: trunk/topology/postgis_topology.c
> ===================================================================
> --- trunk/topology/postgis_topology.c	2017-09-14 13:52:25 UTC (rev 15722)
> +++ trunk/topology/postgis_topology.c	2017-09-14 13:56:57 UTC (rev 15723)
> @@ -170,21 +170,19 @@
>    static SPIPlanPtr plan = NULL;
>  
>    // prepare
> -  if ( ! plan ) {
> -    sql = "SELECT id,srid,precision,null::geometry"
> -                          " FROM topology.topology "
> -                          "WHERE name = $1::varchar";
> -    argtypes[0] = CSTRINGOID;
> -    plan = SPI_prepare(sql, 1, argtypes);
> -    if ( ! plan )
> -    {
> -      cberror(be, "unexpected return (%d) from query preparation: %s",
> -              SPI_result, sql);
> -      return NULL;
> -    }
> -    SPI_keepplan(plan);
> -    // SPI_freeplan to free, eventually
> +  sql = "SELECT id,srid,precision,null::geometry"
> +                        " FROM topology.topology "
> +                        "WHERE name = $1::varchar";
> +  argtypes[0] = CSTRINGOID;
> +  plan = SPI_prepare(sql, 1, argtypes);
> +  if ( ! plan )
> +  {
> +    cberror(be, "unexpected return (%d) from query preparation: %s",
> +            SPI_result, sql);
> +    return NULL;
>    }
> +  SPI_keepplan(plan);
> +  // SPI_freeplan to free, eventually
>  

Or am I missing anything ?

--strk;





More information about the postgis-devel mailing list