openstreetmap / openstreetmap/mod_tile
free(store) in renderd_list not safe for some storages
Open
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 318
- Forks
- 199
- PR merge metrics
- No merged PRs in 30d
Description
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);
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in src/render_list.c at the store->close_storage(store) call and the following free(store), then inspect close_storage implementations such as store_ro_composite.c. Confirm the ownership behavior across storage backends and verify that cleanup is safe for each one. Done means the change builds and no storage path frees the same store twice.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100