Fix asan problems at ci test.

This commit is contained in:
xiao-77 2025-01-09 13:36:23 +08:00
parent 9eb1239783
commit c1732ba41d
4 changed files with 29 additions and 36 deletions

View File

@ -328,12 +328,12 @@ typedef struct {
}; };
} SConfigObj; } SConfigObj;
int32_t tEncodeSConfigObj(SEncoder* pEncoder, const SConfigObj* pObj); int32_t tEncodeSConfigObj(SEncoder* pEncoder, const SConfigObj* pObj);
int32_t tDecodeSConfigObj(SDecoder* pDecoder, SConfigObj* pObj); int32_t tDecodeSConfigObj(SDecoder* pDecoder, SConfigObj* pObj);
SConfigObj* mndInitConfigObj(SConfigItem* pItem); int32_t mndInitConfigObj(SConfigItem* pItem, SConfigObj* pObj);
SConfigObj* mndInitConfigVersion(); SConfigObj mndInitConfigVersion();
int32_t mndUpdateObj(SConfigObj* pObj, const char* name, char* value); int32_t mndUpdateObj(SConfigObj* pObj, const char* name, char* value);
void tFreeSConfigObj(SConfigObj* obj); void tFreeSConfigObj(SConfigObj* obj);
typedef struct { typedef struct {
int32_t maxUsers; int32_t maxUsers;

View File

@ -308,28 +308,27 @@ int32_t mndInitWriteCfg(SMnode *pMnode) {
} }
// encode mnd config version // encode mnd config version
SConfigObj *versionObj = mndInitConfigVersion(); SConfigObj versionObj = mndInitConfigVersion();
if ((code = mndSetCreateConfigCommitLogs(pTrans, versionObj)) != 0) { if ((code = mndSetCreateConfigCommitLogs(pTrans, &versionObj)) != 0) {
mError("failed to init mnd config version, since %s", tstrerror(code)); mError("failed to init mnd config version, since %s", tstrerror(code));
tFreeSConfigObj(versionObj); tFreeSConfigObj(&versionObj);
goto _OVER; goto _OVER;
} }
tFreeSConfigObj(versionObj); tFreeSConfigObj(&versionObj);
sz = taosArrayGetSize(taosGetGlobalCfg(tsCfg)); sz = taosArrayGetSize(taosGetGlobalCfg(tsCfg));
for (int i = 0; i < sz; ++i) { for (int i = 0; i < sz; ++i) {
SConfigItem *item = taosArrayGet(taosGetGlobalCfg(tsCfg), i); SConfigItem *item = taosArrayGet(taosGetGlobalCfg(tsCfg), i);
SConfigObj *pObj = mndInitConfigObj(item); SConfigObj pObj;
if (pObj == NULL) { if ((code = mndInitConfigObj(item, &pObj)) != 0) {
code = terrno;
goto _OVER; goto _OVER;
} }
if ((code = mndSetCreateConfigCommitLogs(pTrans, pObj)) != 0) { if ((code = mndSetCreateConfigCommitLogs(pTrans, &pObj)) != 0) {
mError("failed to init mnd config:%s, since %s", item->name, tstrerror(code)); mError("failed to init mnd config:%s, since %s", item->name, tstrerror(code));
tFreeSConfigObj(pObj); tFreeSConfigObj(&pObj);
goto _OVER; goto _OVER;
} }
tFreeSConfigObj(pObj); tFreeSConfigObj(&pObj);
} }
if ((code = mndTransPrepare(pMnode, pTrans)) != 0) goto _OVER; if ((code = mndTransPrepare(pMnode, pTrans)) != 0) goto _OVER;
@ -386,12 +385,9 @@ static int32_t mndTryRebuildConfigSdb(SRpcMsg *pReq) {
SConfigObj *obj = sdbAcquire(pMnode->pSdb, SDB_CFG, item->name); SConfigObj *obj = sdbAcquire(pMnode->pSdb, SDB_CFG, item->name);
if (obj == NULL) { if (obj == NULL) {
mInfo("config:%s, not exist in sdb, try to add it", item->name); mInfo("config:%s, not exist in sdb, try to add it", item->name);
SConfigObj *newObj = mndInitConfigObj(item); SConfigObj newObj;
if (newObj == NULL) { if ((code = mndInitConfigObj(item, &newObj)) != 0) goto _exit;
code = terrno; if (NULL == taosArrayPush(addArray, &newObj)) {
goto _exit;
}
if (NULL == taosArrayPush(addArray, newObj)) {
code = terrno; code = terrno;
goto _exit; goto _exit;
} }

View File

@ -730,10 +730,7 @@ void *tDecodeSubscribeObj(const void *buf, SMqSubscribeObj *pSub, int8_t sver) {
return (void *)buf; return (void *)buf;
} }
SConfigObj *mndInitConfigObj(SConfigItem *pItem) { int32_t mndInitConfigObj(SConfigItem *pItem, SConfigObj *pObj) {
SConfigObj *pObj;
memset(pObj, 0, sizeof(SConfigObj));
tstrncpy(pObj->name, pItem->name, CFG_NAME_MAX_LEN); tstrncpy(pObj->name, pItem->name, CFG_NAME_MAX_LEN);
pObj->dtype = pItem->dtype; pObj->dtype = pItem->dtype;
switch (pItem->dtype) { switch (pItem->dtype) {
@ -760,11 +757,11 @@ SConfigObj *mndInitConfigObj(SConfigItem *pItem) {
pObj->str = taosStrdup(pItem->str); pObj->str = taosStrdup(pItem->str);
if (pObj->str == NULL) { if (pObj->str == NULL) {
taosMemoryFree(pObj); taosMemoryFree(pObj);
return NULL; return TSDB_CODE_OUT_OF_MEMORY;
} }
break; break;
} }
return pObj; return TSDB_CODE_SUCCESS;
} }
int32_t mndUpdateObj(SConfigObj *pObjNew, const char *name, char *value) { int32_t mndUpdateObj(SConfigObj *pObjNew, const char *name, char *value) {
@ -821,14 +818,14 @@ int32_t mndUpdateObj(SConfigObj *pObjNew, const char *name, char *value) {
return code; return code;
} }
SConfigObj *mndInitConfigVersion() { SConfigObj mndInitConfigVersion() {
SConfigObj *pObj; SConfigObj obj;
memset(pObj, 0, sizeof(SConfigObj)); memset(&obj, 0, sizeof(SConfigObj));
tstrncpy(pObj->name, "tsmmConfigVersion", CFG_NAME_MAX_LEN); tstrncpy(obj.name, "tsmmConfigVersion", CFG_NAME_MAX_LEN);
pObj->dtype = CFG_DTYPE_INT32; obj.dtype = CFG_DTYPE_INT32;
pObj->i32 = 0; obj.i32 = 0;
return pObj; return obj;
} }
int32_t tEncodeSConfigObj(SEncoder *pEncoder, const SConfigObj *pObj) { int32_t tEncodeSConfigObj(SEncoder *pEncoder, const SConfigObj *pObj) {

View File

@ -404,7 +404,7 @@
,,y,system-test,./pytest.sh python3 ./test.py -f 0-others/view/non_marterial_view/test_view.py ,,y,system-test,./pytest.sh python3 ./test.py -f 0-others/view/non_marterial_view/test_view.py
,,y,system-test,./pytest.sh python3 ./test.py -f 0-others/test_show_table_distributed.py ,,y,system-test,./pytest.sh python3 ./test.py -f 0-others/test_show_table_distributed.py
,,y,system-test,./pytest.sh python3 ./test.py -f 0-others/test_show_disk_usage.py ,,y,system-test,./pytest.sh python3 ./test.py -f 0-others/test_show_disk_usage.py
,,n,system-test,python3 ./test.py -f 0-others/compatibility.py ,,n,system-test,python3 ./test.py -f 0-others/compatibility.py -N 3 -M 3
,,n,system-test,python3 ./test.py -f 0-others/tag_index_basic.py ,,n,system-test,python3 ./test.py -f 0-others/tag_index_basic.py
,,n,system-test,python3 ./test.py -f 0-others/udfpy_main.py ,,n,system-test,python3 ./test.py -f 0-others/udfpy_main.py
,,n,system-test,python3 ./test.py -N 3 -f 0-others/walRetention.py ,,n,system-test,python3 ./test.py -N 3 -f 0-others/walRetention.py