summaryrefslogtreecommitdiff
path: root/examples/c/ex_file_system.c
diff options
context:
space:
mode:
authorAlex Gorrod <alexander.gorrod@mongodb.com>2017-04-14 03:25:28 +1000
committerAlex Gorrod <alexander.gorrod@mongodb.com>2017-04-14 03:25:28 +1000
commitf5c08e2b5f02805b062888d45c9eca19af175f7e (patch)
tree0b43098fab6f6059c04c89e9b85337d5f625c5f2 /examples/c/ex_file_system.c
parentd48181f6f4db08761ed7b80b0332908b272ad0d0 (diff)
parentcb16839cfbdf338af95bed43ca40979ae6e32f54 (diff)
downloadmongodb-3.2.13.tar.gz
Merge branch 'mongodb-3.4' into mongodb-3.2mongodb-3.2.13
Diffstat (limited to 'examples/c/ex_file_system.c')
-rw-r--r--examples/c/ex_file_system.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/examples/c/ex_file_system.c b/examples/c/ex_file_system.c
index 56869171558..e807ac54d3b 100644
--- a/examples/c/ex_file_system.c
+++ b/examples/c/ex_file_system.c
@@ -399,6 +399,7 @@ demo_fs_directory_list(WT_FILE_SYSTEM *file_system,
uint32_t allocated, count;
int ret = 0;
char *name, **entries;
+ void *p;
(void)session; /* Unused */
@@ -424,14 +425,16 @@ demo_fs_directory_list(WT_FILE_SYSTEM *file_system,
* matter if the list is a bit longer than necessary.
*/
if (count >= allocated) {
- entries = realloc(
- entries, (allocated + 10) * sizeof(char *));
- if (entries == NULL) {
+ p = realloc(
+ entries, (allocated + 10) * sizeof(*entries));
+ if (p == NULL) {
ret = ENOMEM;
goto err;
}
- memset(entries + allocated * sizeof(char *),
- 0, 10 * sizeof(char *));
+
+ entries = p;
+ memset(entries + allocated * sizeof(*entries),
+ 0, 10 * sizeof(*entries));
allocated += 10;
}
entries[count++] = strdup(name);