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

Memory leak when executing PS for query with IN subquery

    XMLWordPrintable

Details

    Description

      For the following test case a statement memory leak is detected when the server is built with -DWITH_PROTECT_STATEMENT_MEMROOT:BOOL=ON

      CREATE TABLE t1 (a varchar(10)) ENGINE=MYISAM;
      CREATE TABLE t2 (b varchar(10) CHARACTER SET utf8) ENGINE=MYISAM;
      INSERT INTO t1 VALUES ('b'), ('a'), ('c');
      INSERT INTO t2 VALUES ('c'), ('d'), ('b');
      PREPARE stmt FROM "SELECT t1.a FROM t1 WHERE t1.a IN (SELECT t2.b FROM t2)";
      EXECUTE stmt;
      EXECUTE stmt;
      DEALLOCATE PREPARE stmt;
      DROP TABLE t1,t2;
      

      The leak is detected in the function Type_std_attributes::agg_item_set_converter()
      with the following memory allocation

             Item_direct_ref_to_item *ref=
               new (thd->mem_root) Item_direct_ref_to_item(thd, *arg);
      

      Attachments

        Issue Links

          Activity

            People

              shulga Dmitry Shulga
              igor Igor Babaev
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

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