starocean999 commented on code in PR #11546:
URL: https://github.com/apache/doris/pull/11546#discussion_r942445244


##########
be/src/vec/functions/like.cpp:
##########
@@ -117,15 +117,14 @@ Status FunctionLikeBase::regexp_fn(LikeSearchState* 
state, const StringValue& va
 Status FunctionLikeBase::hs_prepare(FunctionContext* context, const char* 
expression,
                                     hs_database_t** database, hs_scratch_t** 
scratch) {
     hs_compile_error_t* compile_err;
-
-    if (hs_compile(expression, HS_FLAG_DOTALL | HS_FLAG_ALLOWEMPTY, 
HS_MODE_BLOCK, NULL, database,
-                   &compile_err) != HS_SUCCESS) {
+    auto res = hs_compile(expression, HS_FLAG_DOTALL | HS_FLAG_ALLOWEMPTY, 
HS_MODE_BLOCK, NULL,
+                          database, &compile_err);
+    if (res != HS_SUCCESS) {
         *database = nullptr;
         if (context) context->set_error("hs_compile regex pattern error");
-        auto status = Status::RuntimeError("hs_compile regex pattern error:" +
-                                           std::string(compile_err->message));
+        return Status::RuntimeError("hs_compile regex pattern error:" +
+                                    std::string(compile_err->message));
         hs_free_compile_error(compile_err);

Review Comment:
   call hs_free_compile_error(compile_err) before return xxx



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to