The dump API currently has a memory leak:
Direct leak of 675 byte(s) in 1 object(s) allocated from:
#0 0x42dab4 in calloc (/home/alexg/work/wiredtiger/build_posix/.libs/lt-wt+0x42dab4)
WT-1 0x7ffff79c21ea in __wt_calloc /home/alexg/work/wiredtiger/build_posix/../src/os_posix/os_alloc.c:38
WT-2 0x7ffff79c56ae in __wt_strndup /home/alexg/work/wiredtiger/build_posix/../src/os_posix/os_alloc.c:183
WT-3 0x7ffff79c5ded in __wt_strdup /home/alexg/work/wiredtiger/build_posix/../src/os_posix/os_alloc.c:203
WT-4 0x7ffff79b0b2a in __wt_metadata_search /home/alexg/work/wiredtiger/build_posix/../src/meta/meta_table.c:182
WT-5 0x7ffff79ab64e in __wt_ext_metadata_search /home/alexg/work/wiredtiger/build_posix/../src/meta/meta_ext.c:62
WT-6 0x4478f1 in dump_config /home/alexg/work/wiredtiger/build_posix/../src/utilities/util_dump.c:191
WT-7 0x445a72 in util_dump /home/alexg/work/wiredtiger/build_posix/../src/utilities/util_dump.c:94
WT-8 0x45ed95 in main /home/alexg/work/wiredtiger/build_posix/../src/utilities/util_main.c:181
It's not trivial to fix this leak, since we are calling:
(*metadata_search)(WT_EXTENSION_API *wt_api, WT_SESSION *session, const char *key, const char **valuep);
and the memory leaked is that returned in valuep. I think we should remove the const from the API, and document that the user is responsible for freeing thre returned string. I've opened an issue, since this is an API change and I could be missing a subtlety.
I made a naive fix for this here:
https://github.com/wiredtiger/wiredtiger/commit/8293fba35f450d1d1e03d7d306e139c1c90c9115
That fix fails testing due to the constness of the value variable (which I could cast away, but I don't think that is the right solution).
- related to
-
WT-1 placeholder WT-1
- Closed
-
WT-2 What does metadata look like?
- Closed
-
WT-3 What file formats are required?
- Closed
-
WT-4 Flexible cursor traversals
- Closed
-
WT-5 How does pget work: is it necessary?
- Closed
-
WT-6 Complex schema example
- Closed
-
WT-7 Do we need the handle->err/errx methods?
- Closed
-
WT-8 Do we need table load, bulk-load and/or dump methods?
- Closed
-
WT-659 WiredTiger's metadata file should be documented and read-only to applications.
- Closed
-
WT-910 Update the metadata cursor implementation.
- Closed