From 6c311f0d119dd7cf114249d7c802d107217137b8 Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Wed, 17 Jun 2020 07:56:41 +0000 Subject: [PATCH] TD-353 --- src/util/src/tkvstore.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/util/src/tkvstore.c b/src/util/src/tkvstore.c index 41632d5b2b..be9c4c19b0 100644 --- a/src/util/src/tkvstore.c +++ b/src/util/src/tkvstore.c @@ -382,7 +382,7 @@ static void *tdDecodeStoreInfo(void *buf, SStoreInfo *pInfo) { } static SKVStore *tdNewKVStore(char *fname, iterFunc iFunc, afterFunc aFunc, void *appH) { - SKVStore *pStore = (SKVStore *)malloc(sizeof(SKVStore)); + SKVStore *pStore = (SKVStore *)calloc(1, sizeof(SKVStore)); if (pStore == NULL) goto _err; pStore->fname = strdup(fname); @@ -392,7 +392,9 @@ static SKVStore *tdNewKVStore(char *fname, iterFunc iFunc, afterFunc aFunc, void } pStore->fsnap = tdGetKVStoreSnapshotFname(fname); - if (pStore->fsnap == NULL) goto _err; + if (pStore->fsnap == NULL) { + goto _err; + } pStore->fnew = tdGetKVStoreNewFname(fname); if (pStore->fnew == NULL) goto _err; -- GitLab