If ai was allocated, free it and do not leak
Do not leak temporary session on srw destroy
Do not leak cache destruction
Do not leak ids generation buffer
Do not locks array
Do not leak temporal buffer in config parser