From 582adda628a6c2b9d310d4e174a4252dbd0f30f8 Mon Sep 17 00:00:00 2001 From: Leonid Yuriev Date: Sun, 14 Oct 2018 17:28:00 +0300 Subject: [PATCH] mdbx-windows: fix mdbx_strdup() usage. Fix commit e229dbe9dca1ff117a714007cc3811c01ba98b8b (12 of 17 for https://github.com/leo-yuriev/libmdbx/issues/43). Change-Id: Ic63864d736319ccba37518a50590f4e21282a451 --- src/osal.h | 2 +- src/tools/mdbx_chk.c | 2 +- src/tools/mdbx_load.c | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/osal.h b/src/osal.h index 22bd84d3..5aabc191 100644 --- a/src/osal.h +++ b/src/osal.h @@ -430,7 +430,7 @@ static __inline size_t mdbx_syspagesize(void) { } #ifndef mdbx_strdup -char *mdbx_strdup(const char *str); +LIBMDBX_API char *mdbx_strdup(const char *str); #endif static __inline int mdbx_get_errno(void) { diff --git a/src/tools/mdbx_chk.c b/src/tools/mdbx_chk.c index 160b0947..6614bdb2 100644 --- a/src/tools/mdbx_chk.c +++ b/src/tools/mdbx_chk.c @@ -164,7 +164,7 @@ static walk_dbi_t *pagemap_lookup_dbi(const char *dbi_name, bool silent) { return NULL; } - dbi->name = strdup(dbi_name); + dbi->name = mdbx_strdup(dbi_name); if (verbose > 1 && !silent) { print(" - found '%s' area\n", dbi_name); fflush(NULL); diff --git a/src/tools/mdbx_load.c b/src/tools/mdbx_load.c index 661336c6..697e3e16 100644 --- a/src/tools/mdbx_load.c +++ b/src/tools/mdbx_load.c @@ -111,7 +111,7 @@ static void readhdr(void) { *ptr = '\0'; if (subname) mdbx_free(subname); - subname = strdup((char *)dbuf.iov_base + STRLENOF("database=")); + subname = mdbx_strdup((char *)dbuf.iov_base + STRLENOF("database=")); } else if (!strncmp(dbuf.iov_base, "type=", STRLENOF("type="))) { if (strncmp((char *)dbuf.iov_base + STRLENOF("type="), "btree", STRLENOF("btree"))) { @@ -349,7 +349,7 @@ int main(int argc, char *argv[]) { envflags |= MDBX_NOSUBDIR; break; case 's': - subname = strdup(optarg); + subname = mdbx_strdup(optarg); break; case 'N': putflags = MDBX_NOOVERWRITE | MDBX_NODUPDATA;