[Tile-serving] [mod_tile] free(store) in renderd_list not safe for some storages (#66)

kayrus notifications at github.com
Fri Jan 24 09:37:20 UTC 2014


Some storages already have free(store) in close function. For example store_ro_composite.c:
```
static int ro_composite_close_storage(struct storage_backend * store) {
    struct ro_composite_ctx * ctx = (struct ro_composite_ctx *)(store->storage_ctx);
    ctx->store_primary->close_storage(ctx->store_primary);
    ctx->store_secondary->close_storage(ctx->store_secondary);
    if(ctx->cache.tile) free(ctx->cache.tile);
    free(ctx);
    free(store);
    return 0;
}
```

Here is the patch for renderd_list.c
```
--- a/src/render_list.c
+++ b/src/render_list.c
@@ -301,7 +301,9 @@ int main(int argc, char **argv)
     }

     store->close_storage(store);
-    free(store);
+    if (store != NULL) {
+        free(store);
+    }
     finish_workers();

     free(spath);
```

---
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/mod_tile/issues/66
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/tile-serving/attachments/20140124/d7a178bb/attachment.html>


More information about the Tile-serving mailing list