[mapserver-commits] r12437 - trunk/mapserver/mapcache/src

svn at osgeo.org svn at osgeo.org
Fri Aug 26 07:26:00 EDT 2011


Author: tbonfort
Date: 2011-08-26 04:26:00 -0700 (Fri, 26 Aug 2011)
New Revision: 12437

Modified:
   trunk/mapserver/mapcache/src/configuration.c
Log:
<source> is now optional when configuring a tileset (typically for mbtiles support)
fix some segfaults in capabilities when no format was configured
thomas.bonfort | 2011-08-18 15:26:00 +0200 (Thu, 18 Aug 2011)

Modified: trunk/mapserver/mapcache/src/configuration.c
===================================================================
--- trunk/mapserver/mapcache/src/configuration.c	2011-08-26 11:25:56 UTC (rev 12436)
+++ trunk/mapserver/mapcache/src/configuration.c	2011-08-26 11:26:00 UTC (rev 12437)
@@ -747,13 +747,11 @@
              ctx->set_error(ctx,400, "watermark config entry empty");
              return;
          }
-         apr_pool_t *tmppool;
-         apr_pool_create(&tmppool,ctx->pool);
          apr_file_t *f;
          apr_finfo_t finfo;
          int rv;
          if(apr_file_open(&f, cur_node->txt, APR_FOPEN_READ|APR_FOPEN_BUFFERED|APR_FOPEN_BINARY,
-                APR_OS_DEFAULT, tmppool) != APR_SUCCESS) {
+                APR_OS_DEFAULT, ctx->pool) != APR_SUCCESS) {
              ctx->set_error(ctx,500, "failed to open watermark image %s",cur_node->txt);
              return;
          }
@@ -763,19 +761,18 @@
             return;
          }
 
-         geocache_buffer *watermarkdata = geocache_buffer_create(finfo.size,tmppool);
+         geocache_buffer *watermarkdata = geocache_buffer_create(finfo.size,ctx->pool);
          //manually add the data to our buffer
          apr_size_t size;
          apr_file_read(f,(void*)watermarkdata->buf,&size);
          watermarkdata->size = size;
-         apr_file_close(f);
          if(size != finfo.size) {
             ctx->set_error(ctx, 500,  "failed to copy watermark image data, got %d of %d bytes",(int)size, (int)finfo.size);
             return;
          }
+         apr_file_close(f);
          tileset->watermark = geocache_imageio_decode(ctx,watermarkdata);
          GC_CHECK_ERROR(ctx);
-         apr_pool_destroy(tmppool);
    }
       
 



More information about the mapserver-commits mailing list