diff --git a/deploy/cpp_infer/src/config.cpp b/deploy/cpp_infer/src/config.cpp index a0ac1d08c93d1ff1e51f769465b2df2b4355fbc0..e55d178b57c9acfea862adb9e648364d7dd86a58 100644 --- a/deploy/cpp_infer/src/config.cpp +++ b/deploy/cpp_infer/src/config.cpp @@ -21,10 +21,12 @@ std::vector OCRConfig::split(const std::string &str, std::vector res; if ("" == str) return res; - char strs[str.length() + 1]; + int strlen = str.length() + 1; + char *strs = new char[strlen]; std::strcpy(strs, str.c_str()); - char d[delim.length() + 1]; + int delimlen = delim.length() + 1; + char *d = new char[delimlen]; std::strcpy(d, delim.c_str()); char *p = std::strtok(strs, d); @@ -34,6 +36,8 @@ std::vector OCRConfig::split(const std::string &str, p = std::strtok(NULL, d); } + delete[] strs; + delete[] d; return res; }