yiguolei commented on code in PR #33622:
URL: https://github.com/apache/doris/pull/33622#discussion_r1571151415


##########
be/src/util/block_compression.cpp:
##########
@@ -116,13 +121,11 @@ class Lz4BlockCompression : public BlockCompressionCodec {
                     input.size);
         }
 
-        Context* context;
-        RETURN_IF_ERROR(_acquire_compression_ctx(&context));
+        std::unique_ptr<Context> context;
+        RETURN_IF_ERROR(_acquire_compression_ctx(context));
         bool compress_failed = false;
         Defer defer {[&] {
-            if (compress_failed) {
-                _delete_compression_ctx(context);
-            } else {
+            if (!compress_failed) {
                 _release_compression_ctx(context);

Review Comment:
   use std::move(context). Then the developer will know the context ptr is 
invalid now.



-- 
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