You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by GitBox <gi...@apache.org> on 2020/05/07 01:14:17 UTC

[GitHub] [incubator-doris] imay commented on a change in pull request #3495: [ASAN] Fix some address problems detected by ASAN

imay commented on a change in pull request #3495:
URL: https://github.com/apache/incubator-doris/pull/3495#discussion_r421181564



##########
File path: be/src/util/path_util.cpp
##########
@@ -70,13 +70,19 @@ vector<string> split_path(const string& path) {
     return segments;
 }
 
+struct FreeDeleter {
+    inline void operator()(void* ptr) const {
+        free(ptr);
+    }
+};
+
 string dir_name(const string& path) {
-    std::unique_ptr<char[]> path_copy(strdup(path.c_str()));
+    std::unique_ptr<char[], FreeDeleter> path_copy(strdup(path.c_str()));

Review comment:
       > std::vector<char> path_copy(path.c_str(), path.c_str() + path.size() + 1);
   
   what you want to mean is that `std::vector<char> path_copy(path.begin(), path.end())`




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

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