enh: code optimization for tbase58

This commit is contained in:
kailixu 2024-02-22 19:04:21 +08:00
parent 5b0fc1544d
commit 75caea4fbf
1 changed files with 1 additions and 1 deletions

View File

@ -145,7 +145,7 @@ uint8_t *base58_decode(const char *value, size_t inlen, int32_t *outlen) {
const uint8_t *it = pbuf + (size - len); const uint8_t *it = pbuf + (size - len);
while (it != pbuf + size && *it == 0) ++it; while (it != pbuf + size && *it == 0) ++it;
uint8_t *result = taosMemoryCalloc(1, inlen + 1); uint8_t *result = taosMemoryCalloc(1, nz + (pbuf + size - it) + 1);
if (!result) { if (!result) {
if (bfree) taosMemoryFree(pbuf); if (bfree) taosMemoryFree(pbuf);
terrno = TSDB_CODE_OUT_OF_MEMORY; terrno = TSDB_CODE_OUT_OF_MEMORY;