Uploaded image for project: 'Percona Server for MySQL'
  1. Percona Server for MySQL
  2. PS-5307

mysqldump: memory leak and needless allocation in compression dictionaries

    Details

      Description

      Seen on e.g. MTR with LeakSanitizer:

      190102 17:50:33 [ 86%] innodb.xtradb_compressed_columns_mysqldump w2 [ fail ]
              Test ended at 2019-01-02 17:50:33
      
      CURRENT_TEST: innodb.xtradb_compressed_columns_mysqldump
      
      =================================================================
      ==8734==ERROR: LeakSanitizer: detected memory leaks
      
      Direct leak of 105 byte(s) in 3 object(s) allocated from:
          #0 0x7f9c0c0f3c50 in malloc (/usr/lib64/libasan.so.4+0xd9c50)
          #1 0x4b31f7 in my_raw_malloc mysys/my_malloc.cc:199
          #2 0x4b332f in my_malloc(unsigned int, unsigned long, int) mysys/my_malloc.cc:81
          #3 0x4b3952 in my_strdup(unsigned int, char const*, int) mysys/my_malloc.cc:295
          #4 0x479f3e in print_optional_create_compression_dictionary client/mysqldump.cc:2999
          #5 0x47ce5b in get_table_structure client/mysqldump.cc:3401
          #6 0x47e658 in dump_table client/mysqldump.cc:4188
          #7 0x482d96 in dump_all_tables_in_db client/mysqldump.cc:5111
          #8 0x48412d in dump_databases client/mysqldump.cc:4951
          #9 0x459220 in main client/mysqldump.cc:6523
          #10 0x7f9c09957d1f in __libc_start_main (/lib64/libc.so.6+0x1ed1f)
      

      The code is

          processed_compression_dictionaries->emplace(
              my_strdup(PSI_NOT_INSTRUMENTED, dictionary_name, MYF(0)));
      

      processed_compression_dictionaries is a container of std::strings, making my_strdup redundant (the string will copy itself) and leaking in this case

        Smart Checklist

          Attachments

            Activity

              People

              • Assignee:
                laurynas.biveinis Laurynas Biveinis (Inactive)
                Reporter:
                laurynas.biveinis Laurynas Biveinis (Inactive)
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - Not Specified
                  Not Specified
                  Logged:
                  Time Spent - 12 minutes
                  12m