If rados_ioctx_destroy called with un-initilized ioctx we will hit segmented fault
checking ioctx before calling put will prevent that.
Fixes: https://tracker.ceph.com/issues/55001
Signed-off-by: Nitzan Mordechai <nmordec@redhat.com>
(cherry picked from commit
e465cfc62ae0f982edb60291c67f4d76a71efd15)
{
tracepoint(librados, rados_ioctx_destroy_enter, io);
librados::IoCtxImpl *ctx = (librados::IoCtxImpl *)io;
- ctx->put();
+ if (ctx) {
+ ctx->put();
+ }
tracepoint(librados, rados_ioctx_destroy_exit);
}
LIBRADOS_C_API_BASE_DEFAULT(rados_ioctx_destroy);