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