summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2020-10-10 09:53:04 +0800
committerPeng Wu <alexepico@gmail.com>2020-10-10 09:53:04 +0800
commite169b3d22c215ba1485e110a194da904a86751e8 (patch)
tree8e6e038be651e9742c607eac316b1aab25b8ed5c
parentb0bfcf10a1e03d89061054693b803d199c7506e1 (diff)
downloadlibpinyin-e169b3d22c215ba1485e110a194da904a86751e8.tar.gz
libpinyin-e169b3d22c215ba1485e110a194da904a86751e8.tar.xz
libpinyin-e169b3d22c215ba1485e110a194da904a86751e8.zip
Fixes copy_bdb function
-rw-r--r--src/storage/bdb_utils.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/storage/bdb_utils.h b/src/storage/bdb_utils.h
index b1c5832..7a83793 100644
--- a/src/storage/bdb_utils.h
+++ b/src/storage/bdb_utils.h
@@ -59,6 +59,10 @@ inline bool copy_bdb(DB * srcdb, DB * destdb) {
while ((ret = cursorp->c_get(cursorp, &key, &data, DB_NEXT)) == 0) {
ret = destdb->put(destdb, NULL, &key, &data, 0);
assert(0 == ret);
+
+ /* Initialize our DBTs. */
+ memset(&key, 0, sizeof(DBT));
+ memset(&data, 0, sizeof(DBT));
}
assert(DB_NOTFOUND == ret);