diff --git a/src/mnode/src/mnodeDb.c b/src/mnode/src/mnodeDb.c index 3666d61adc8b2c10b1c7615422b4db7031bc1251..69783defc7aa8065f8426a534e4a1c6dbc172f54 100644 --- a/src/mnode/src/mnodeDb.c +++ b/src/mnode/src/mnodeDb.c @@ -84,9 +84,12 @@ static int32_t mnodeDbActionDelete(SSdbOper *pOper) { mnodeDropAllChildTables(pDb); mnodeDropAllSuperTables(pDb); mnodeDropAllDbVgroups(pDb); - mnodeDropDbFromAcct(pAcct, pDb); - mnodeDecAcctRef(pAcct); - + + if (pAcct) { + mnodeDropDbFromAcct(pAcct, pDb); + mnodeDecAcctRef(pAcct); + } + return TSDB_CODE_SUCCESS; } diff --git a/src/mnode/src/mnodeTable.c b/src/mnode/src/mnodeTable.c index 478e7790fba3405139d94548b219d2e2e857e12e..0ff198bf8f709cd48eb238e94c31ff3f33a2ea33 100644 --- a/src/mnode/src/mnodeTable.c +++ b/src/mnode/src/mnodeTable.c @@ -157,10 +157,12 @@ static int32_t mnodeChildTableActionDelete(SSdbOper *pOper) { if (pDb != NULL) pAcct = mnodeGetAcct(pDb->acct); if (pTable->info.type == TSDB_CHILD_TABLE) { - grantRestore(TSDB_GRANT_TIMESERIES, pTable->superTable->numOfColumns - 1); - if (pAcct != NULL) pAcct->acctInfo.numOfTimeSeries -= (pTable->superTable->numOfColumns - 1); - mnodeRemoveTableFromStable(pTable->superTable, pTable); - mnodeDecTableRef(pTable->superTable); + if (pTable->superTable) { + grantRestore(TSDB_GRANT_TIMESERIES, pTable->superTable->numOfColumns - 1); + if (pAcct != NULL) pAcct->acctInfo.numOfTimeSeries -= (pTable->superTable->numOfColumns - 1); + mnodeRemoveTableFromStable(pTable->superTable, pTable); + mnodeDecTableRef(pTable->superTable); + } } else { grantRestore(TSDB_GRANT_TIMESERIES, pTable->numOfColumns - 1); if (pAcct != NULL) pAcct->acctInfo.numOfTimeSeries -= (pTable->numOfColumns - 1);