[GIS]fix SRSWKTParser memory leak
This commit is contained in:
5
deps/oblib/src/lib/geo/ob_srs_wkt_parser.cpp
vendored
5
deps/oblib/src/lib/geo/ob_srs_wkt_parser.cpp
vendored
@ -318,7 +318,7 @@ static int parse_coordinate_system(common::ObIAllocator &allocator, const common
|
|||||||
char l_brac = r_brac == ')' ? '(' : '[';
|
char l_brac = r_brac == ')' ? '(' : '[';
|
||||||
const char *begin = srs_str.ptr();
|
const char *begin = srs_str.ptr();
|
||||||
const char *end = begin + last + 1; // past the last
|
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)) {
|
if (OB_ISNULL(buf)) {
|
||||||
ret = OB_ERR_UNEXPECTED;
|
ret = OB_ERR_UNEXPECTED;
|
||||||
LOG_WARN("alloc SrsWktGrammar failed", K(ret));
|
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);
|
ObString trailing_str(end - begin, begin);
|
||||||
LOG_WARN("failed to parse coodinate sytem, has extra trailing characters", K(trailing_str));
|
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;
|
return ret;
|
||||||
|
|||||||
Reference in New Issue
Block a user