fix: memory leak of geos
This commit is contained in:
parent
11d25078c0
commit
6cd7fd0288
|
@ -24,7 +24,6 @@
|
|||
#include "scheduler.h"
|
||||
#include "tcompare.h"
|
||||
#include "tdatablock.h"
|
||||
#include "tgeosctx.h"
|
||||
#include "tglobal.h"
|
||||
#include "tmsg.h"
|
||||
#include "tref.h"
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
#include "index.h"
|
||||
#include "qworker.h"
|
||||
#include "tcompression.h"
|
||||
#include "tgeosctx.h"
|
||||
#include "tglobal.h"
|
||||
#include "tgrant.h"
|
||||
#include "tstream.h"
|
||||
|
|
|
@ -419,7 +419,6 @@ int32_t readGeometry(const unsigned char *input, GEOSGeometry **outputGeom,
|
|||
|
||||
SGeosContext *geosCtx = NULL;
|
||||
TAOS_CHECK_RETURN(getThreadLocalGeosCtx(&geosCtx));
|
||||
|
||||
*outputGeom = GEOSWKBReader_read_r(geosCtx->handle, geosCtx->WKBReader, varDataVal(input), varDataLen(input));
|
||||
if (*outputGeom == NULL) {
|
||||
return TSDB_CODE_FUNC_FUNTION_PARA_VALUE;
|
||||
|
|
|
@ -72,21 +72,13 @@ int32_t getThreadLocalGeosCtx(SGeosContext **ppCtx) {
|
|||
TAOS_CHECK_EXIT(TAOS_SYSTEM_ERROR(errno));
|
||||
}
|
||||
|
||||
tlGeosCtx = taosThreadGetSpecific(tlGeosCtxKey);
|
||||
if (tlGeosCtx == NULL) {
|
||||
if (errno) {
|
||||
TAOS_CHECK_EXIT(TAOS_SYSTEM_ERROR(errno));
|
||||
} else {
|
||||
TAOS_CHECK_EXIT(TSDB_CODE_NOT_FOUND);
|
||||
}
|
||||
}
|
||||
tlGeosCtx = &tlGeosCtxObj;
|
||||
*ppCtx = tlGeosCtx;
|
||||
_exit:
|
||||
if (code != 0) {
|
||||
*ppCtx = NULL;
|
||||
uError("failed to get geos context at lino:%d since %s", lino, tstrerror(code));
|
||||
}
|
||||
|
||||
TAOS_RETURN(code);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue