diff --git a/tree/treeplayer/inc/ROOT/TDataFrame.hxx b/tree/treeplayer/inc/ROOT/TDataFrame.hxx
index cfe9486ff1d596783b752ec1b6f42fd5700c4671..c1f5d449bb969395d189f04c4c3c885f5a74457d 100644
--- a/tree/treeplayer/inc/ROOT/TDataFrame.hxx
+++ b/tree/treeplayer/inc/ROOT/TDataFrame.hxx
@@ -163,7 +163,7 @@ class TDataFrameImpl;
 namespace Internal {
 
 const char *ToConstCharPtr(const char *s);
-const char *ToConstCharPtr(const std::string s);
+const char *ToConstCharPtr(const std::string& s);
 std::string ColumnName2ColumnTypeName(const std::string &colName, ROOT::Detail::TDataFrameImpl &df);
 unsigned int GetNSlots();
 
diff --git a/tree/treeplayer/src/TDataFrame.cxx b/tree/treeplayer/src/TDataFrame.cxx
index bf5c55bf1aaca9bce3d996076f06cc2adbbaa4e8..c8ae86602b0490651feaffc848ec5cdc33e0ec52 100644
--- a/tree/treeplayer/src/TDataFrame.cxx
+++ b/tree/treeplayer/src/TDataFrame.cxx
@@ -427,7 +427,7 @@ const char *ToConstCharPtr(const char *s)
    return s;
 }
 
-const char *ToConstCharPtr(const std::string s)
+const char *ToConstCharPtr(const std::string& s)
 {
    return s.c_str();
 }