You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by "yiguolei (via GitHub)" <gi...@apache.org> on 2023/04/26 11:39:05 UTC

[GitHub] [doris] yiguolei commented on a diff in pull request #19116: [bug](fix)fix Geo memory leak

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


##########
be/src/geo/wkb_parse.cpp:
##########
@@ -150,30 +150,30 @@ GeoShape* WkbParse::readGeometry(WkbParseContext* ctx) {
 
     uint32_t geometryType = (typeInt & 0xffff) % 1000;
 
-    GeoShape* shape;
+    std::unique_ptr<GeoShape> shape;
 
     switch (geometryType) {
     case wkbType::wkbPoint:
-        shape = readPoint(ctx);
+        shape.reset(readPoint(ctx));
         break;
     case wkbType::wkbLine:
-        shape = readLine(ctx);
+        shape.reset(readLine(ctx));
         break;
     case wkbType::wkbPolygon:
-        shape = readPolygon(ctx);
+        shape.reset(readPolygon(ctx));
         break;
     default:
         return nullptr;
     }
-    return shape;
+    return shape.release();

Review Comment:
   make  readGeometry method return std::unique_ptr<GeoShape>?



-- 
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-unsubscribe@doris.apache.org

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


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