[GIS]fix SRSWKTParser memory leak

This commit is contained in:
obdev 2023-08-07 07:18:34 +00:00 committed by ob-robot
parent d80f0e538c
commit c60cc58da2

View File

@ -318,7 +318,7 @@ static int parse_coordinate_system(common::ObIAllocator &allocator, const common
char l_brac = r_brac == ')' ? '(' : '[';
const char *begin = srs_str.ptr();
const char *end = begin + last + 1; // past the last
void *buf = allocator.alloc(sizeof(SrsWktGrammar<decltype(begin), boost::spirit::ascii::space_type>));
void *buf = tmp_alloc.alloc(sizeof(SrsWktGrammar<decltype(begin), boost::spirit::ascii::space_type>));
if (OB_ISNULL(buf)) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("alloc SrsWktGrammar failed", K(ret));
@ -334,6 +334,9 @@ static int parse_coordinate_system(common::ObIAllocator &allocator, const common
ObString trailing_str(end - begin, begin);
LOG_WARN("failed to parse coodinate sytem, has extra trailing characters", K(trailing_str));
}
if (OB_NOT_NULL(parser)) {
parser->~SrsWktGrammar<decltype(begin), boost::spirit::ascii::space_type>();
}
}
}
return ret;