42 resource_pool_types = cxHashMapCreate(cxDefaultAllocator, CX_STORE_POINTERS, 4); |
42 resource_pool_types = cxHashMapCreate(cxDefaultAllocator, CX_STORE_POINTERS, 4); |
43 return resource_pool_types ? 0 : 1; |
43 return resource_pool_types ? 0 : 1; |
44 } |
44 } |
45 |
45 |
46 void resource_pool_cleanup(void) { |
46 void resource_pool_cleanup(void) { |
47 cxMapDestroy(resource_pool_types); |
47 cxMapFree(resource_pool_types); |
48 } |
48 } |
49 |
49 |
50 int resourcepool_register_type(const char *type_name, ResourceType *type_info) { |
50 int resourcepool_register_type(const char *type_name, ResourceType *type_info) { |
51 if(cxMapPut(resource_pool_types, cx_hash_key_str(type_name), type_info)) { |
51 if(cxMapPut(resource_pool_types, cx_hash_key_str(type_name), type_info)) { |
52 log_ereport(LOG_CATASTROPHE, "resourcepool_register_type: OOM"); |
52 log_ereport(LOG_CATASTROPHE, "resourcepool_register_type: OOM"); |
229 ResourcePool *respool = resource->resourcepool; |
229 ResourcePool *respool = resource->resourcepool; |
230 |
230 |
231 if(nsapi_rq && !nsapi_rq->finished) { |
231 if(nsapi_rq && !nsapi_rq->finished) { |
232 // request processing still ongoing and SAFs will be executed |
232 // request processing still ongoing and SAFs will be executed |
233 // TODO: future ucx cxMapRemove returns, if it actually removed something, therefore use just cxMapRemove |
233 // TODO: future ucx cxMapRemove returns, if it actually removed something, therefore use just cxMapRemove |
234 if(!cxMapRemoveAndGet(nsapi_rq->resources, cx_hash_key_str(respool->name))) { |
234 void *value; |
|
235 if(!cxMapRemoveAndGet(nsapi_rq->resources, cx_hash_key_str(respool->name), &value)) { |
235 log_ereport(LOG_FAILURE, "resourcepool_free: cannot remove resource from request: potential double free"); |
236 log_ereport(LOG_FAILURE, "resourcepool_free: cannot remove resource from request: potential double free"); |
236 } |
237 } |
237 } |
238 } |
238 // else: safe to ignore nsapi_rq->resources |
239 // else: safe to ignore nsapi_rq->resources |
239 |
240 |