diff --git a/deploy/cpp_infer/src/config.cpp b/deploy/cpp_infer/src/config.cpp index 050b75ede9475432f250cafac2cd5fbed17fea0a..22e036532f724e64ac74b07401e766c06761f89b 100644 --- a/deploy/cpp_infer/src/config.cpp +++ b/deploy/cpp_infer/src/config.cpp @@ -23,16 +23,13 @@ std::vector OCRConfig::split(const std::string &str, return res; int strlen = str.length() + 1; - chars *strs = new char[strlen]; + char *strs = new char[strlen]; std::strcpy(strs, str.c_str()); int delimlen = delim.length() + 1; char *d = new char[delimlen]; std::strcpy(d, delim.c_str()); - delete[] strs; - delete[] d; - char *p = std::strtok(strs, d); while (p) { std::string s = p; @@ -40,6 +37,9 @@ std::vector OCRConfig::split(const std::string &str, p = std::strtok(NULL, d); } + delete[] strs; + delete[] d; + return res; }