From fba0c94f9c9e005a0105c4ecafa0c9bde250bcd0 Mon Sep 17 00:00:00 2001 From: LDOUBLEV Date: Mon, 9 Aug 2021 12:44:14 +0000 Subject: [PATCH] fix cpp --- deploy/cpp_infer/src/config.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/deploy/cpp_infer/src/config.cpp b/deploy/cpp_infer/src/config.cpp index a0ac1d08..e55d178b 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; } -- GitLab