diff --git a/src/sql/ob_spi.cpp b/src/sql/ob_spi.cpp index ad77ee1122..15b3fc738d 100644 --- a/src/sql/ob_spi.cpp +++ b/src/sql/ob_spi.cpp @@ -3745,7 +3745,7 @@ int ObSPIService::spi_cursor_open(ObPLExecCtx *ctx, } OX (spi_cursor->row_store_.finish_add_row()) OX (cursor->open(spi_cursor)); - if (OB_FAIL(ret)) { + if (OB_FAIL(ret) && OB_NOT_NULL(spi_cursor)) { spi_cursor->~ObSPICursor(); } }