Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-41242

Fix resource leaks on error paths in InnoDB and mariabackup found by static analysis

    XMLWordPrintable

Details

    • Bug
    • Status: In Review (View Workflow)
    • Major
    • Resolution: Unresolved
    • 11.4, 11.8, 12.3
    • 11.4, 11.8, 12.3
    • None
    • None
    • Q4/2026 Server Maintenance

    Description

      Bug to fix different reports from Infer
      MENT-2716, MENT-2717, MENT-2718, MENT-2719, MENT-2884

      Infer static analysis reports (MEMORY_LEAK_C / PULSE_RESOURCE_LEAK / USE_AFTER_FREE) across storage/innobase and extra/mariabackup

      Reported issues:

      1. storage/innobase/fts/fts0blex.cc:1530 — MEMORY_LEAK_C
      Memory allocated by fts0balloc() (malloc) on line 1519 is not freed after
      the last access at line 1530, in yy_create_buffer().

      2. storage/innobase/buf/buf0dump.cc:334 — PULSE_RESOURCE_LEAK
      File descriptor opened via fopen() on line 259 is not closed after the
      last access at line 334, in buf_dump().

      3. storage/innobase/fsp/fsp0sysspace.cc:587 — PULSE_RESOURCE_LEAK
      File descriptor opened indirectly via Datafile::open_or_create() on line
      576 is not closed after the last access at line 587, in
      SysTablespace::read_lsn_and_check_flags().

      4. storage/innobase/log/log0recv.cc:1735 — PULSE_RESOURCE_LEAK
      File descriptor opened indirectly via os_file_create_func() on line 1714
      is not closed after the last access at line 1735, in
      recv_sys_t::find_checkpoint().

      5. storage/innobase/log/log0recv.cc:1757 — PULSE_RESOURCE_LEAK
      File descriptor opened indirectly via os_file_create_func() on line 1744
      is not closed after the last access at line 1757, in
      recv_sys_t::find_checkpoint().

      6. storage/innobase/fil/fil0fil.cc:1257 — USE_AFTER_FREE
      Access to `f`, previously closed with fclose() on line 1247, at line 1257,
      in fil_system_t::create().

      7. extra/mariabackup/wsrep.cc:98 — PULSE_RESOURCE_LEAK
      File descriptor opened via fopen() on line 92 is not closed after the
      last access at line 98.

      8. extra/mariabackup/wsrep.cc:106 — PULSE_RESOURCE_LEAK
      File descriptor opened via fopen() on line 91 is not closed after the
      last access at line 106.

      9. extra/mariabackup/wsrep.cc:106 — PULSE_RESOURCE_LEAK
      File descriptor opened via fopen() on line 92 is not closed after the
      last access at line 106.

      10. extra/mariabackup/xtrabackup.cc:4848 — PULSE_RESOURCE_LEAK
      File descriptor opened via fopen() on line 4838 is not closed after the
      last access at line 4848, in xb_load_list_file().

      11. extra/mariabackup/xtrabackup.cc:6735 — PULSE_RESOURCE_LEAK
      File descriptor (directory handle) opened via fopen()-modeled call on
      line 6733 is not closed after the last access at line 6735, in
      xb_process_datadir().

      12. extra/mariabackup/backup_copy.cc:244 — MEMORY_LEAK_C
      Memory allocated by malloc on line 219 is not freed after the last
      access at line 244, in datadir_iter_new().

      Attachments

        Activity

          People

            thiru Thirunarayanan Balathandayuthapani
            tafzeel Mohammad Tafzeel Shams
            Mohammad Tafzeel Shams Mohammad Tafzeel Shams
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Time Tracking

                Estimated:
                Original Estimate - 3h 22m Original Estimate - 3h 22m
                3h 22m
                Remaining:
                Time Spent - 1d Remaining Estimate - 3h 22m
                3h 22m
                Logged:
                Time Spent - 1d Remaining Estimate - 3h 22m
                1d

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.