Uploaded image for project: 'WiredTiger'
  1. WiredTiger
  2. WT-2782

Missing a fs_directory_list_free in ex_file_system.c

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Minor - P4 Minor - P4
    • WT2.9.0, 3.2.10, 3.3.11
    • Affects Version/s: None
    • Component/s: None
    • None

      Using the branch 'develop.'

      I'm implementing a custom filesystem and catch this problem using code similar to ex_file_sytem.c. I'm wondering why there is 1 missing fs_directory_list_free?

      When running ex_file_system, demo_fs_directory_list_free is not called because demo_fs_directory_list calls don't match the prefix so they all returned NULL. Not a problem there.

      However, in order to see the problem, you need to change the code in demo_fs_directory_list() to always allocate entries even when there is no matching entries and count stay 0 (i.e. just so to see the missing free call), e.g.:

      allocated = 10;
      entries = calloc(allocated, sizeof(char*));
      count = 0;

      And put some printf statements in both demo_fs_directory_list() and demo_fs_directory_list_free(), you will find that there is a missing demo_fs_directory_list_free() call.

      Here's the output with my printf statements showing the second WiredTigerPrepLog 0x1f26ef0 is not being freed.

      demo_fs_directory_list WT_HOME/. WiredTigerTmplog 0x1f26260
      demo_fs_directory_list_free 0x1f26260
      demo_fs_directory_list WT_HOME/. WiredTigerPreplog 0x1f25a10
      demo_fs_directory_list_free 0x1f25a10
      demo_fs_directory_list WT_HOME/. WiredTigerLog 0x1f25a10
      demo_fs_directory_list WT_HOME/. WiredTigerPreplog 0x1f26ef0
      demo_fs_directory_list_free 0x1f25a10
      demo_fs_directory_list WT_HOME/. WiredTigerPreplog 0x7f02180008e0
      demo_fs_directory_list_free 0x7f02180008e0
      demo_fs_directory_list WT_HOME/. WiredTigerLog 0x7f02180008e0
      demo_fs_directory_list_free 0x7f02180008e0

            Assignee:
            alexander.gorrod@mongodb.com Alexander Gorrod
            Reporter:
            deyohong Deyoung Hong
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: