← Back to team overview

enterprise-support team mailing list archive

[Bug 1588845] [NEW] mysqldump get_view_structure does not free MYSQL_RES in one error path

 

Public bug reported:

Copy of http://bugs.mysql.com/bug.php?id=81714:

[3 Jun 14:14] Laurynas Biveinis
Description:
A minor code review bug, credit to my colleague Yura Sorokin:

static my_bool get_view_structure(char *table, char* db)
{
  MYSQL_RES  *table_res;
...
  if (mysql_query_with_error_report(mysql, &table_res, query))
...
  if (path)
  {
    if (!(sql_file= open_sql_file_for_table(table, O_WRONLY)))
      DBUG_RETURN(1);

Thus, mysql_free_result is not called here.

How to repeat:
Code review

Suggested fix:
For 5.7, call mysql_free_result there.

For lower versions, backport [1], and call mysql_free_result there.

[1]:

commit 353dbcee4a27b8cfbbd127a28a043bdda764dcf1
Author: Jon Olav Hauglid <jon.hauglid@xxxxxxxxxx>
Date:   Fri Jun 12 14:55:35 2015 +0200

    Bug#21246627: ASAN: MEMORY LEAK IN PROCESS_SET_GTID_PURGED()
    Bug#21250584: ASAN: MEMORY LEAK IN MYSQLDUMP
    
    Fix three different memory leaks in mysqldump:
    1) Remember to call dynstr_free() on DYNAMIC_STRING.
    2) Remember to call mysql_free_result() on MYSQL_RES.
    3) Remember to call my_free() on string allocated by alloc_query_str().

** Affects: mysql-server
     Importance: Unknown
         Status: Unknown

** Affects: percona-server
     Importance: Low
     Assignee: Laurynas Biveinis (laurynas-biveinis)
         Status: In Progress

** Affects: percona-server/5.5
     Importance: Low
     Assignee: Laurynas Biveinis (laurynas-biveinis)
         Status: Fix Committed

** Affects: percona-server/5.6
     Importance: Low
     Assignee: Laurynas Biveinis (laurynas-biveinis)
         Status: Fix Committed

** Affects: percona-server/5.7
     Importance: Low
     Assignee: Laurynas Biveinis (laurynas-biveinis)
         Status: In Progress


** Tags: upstream

** Also affects: percona-server/5.5
   Importance: Undecided
       Status: New

** Also affects: percona-server/5.6
   Importance: Undecided
       Status: New

** Also affects: percona-server/5.7
   Importance: Undecided
       Status: New

** Changed in: percona-server/5.5
       Status: New => Triaged

** Changed in: percona-server/5.5
       Status: Triaged => Fix Committed

** Changed in: percona-server/5.6
       Status: New => Fix Committed

** Changed in: percona-server/5.7
       Status: New => In Progress

** Changed in: percona-server/5.7
   Importance: Undecided => Low

** Changed in: percona-server/5.5
   Importance: Undecided => Low

** Changed in: percona-server/5.6
   Importance: Undecided => Low

** Changed in: percona-server/5.5
     Assignee: (unassigned) => Laurynas Biveinis (laurynas-biveinis)

** Changed in: percona-server/5.6
     Assignee: (unassigned) => Laurynas Biveinis (laurynas-biveinis)

** Changed in: percona-server/5.7
     Assignee: (unassigned) => Laurynas Biveinis (laurynas-biveinis)

** Tags added: upstream

** Bug watch added: MySQL Bug System #81714
   http://bugs.mysql.com/bug.php?id=81714

** Also affects: mysql-server via
   http://bugs.mysql.com/bug.php?id=81714
   Importance: Unknown
       Status: Unknown

-- 
You received this bug notification because you are a member of Ubuntu
Server/Client Support Team, which is subscribed to MySQL.
Matching subscriptions: Ubuntu Server/Client Support Team
https://bugs.launchpad.net/bugs/1588845

Title:
  mysqldump get_view_structure does not free MYSQL_RES in one error path

To manage notifications about this bug go to:
https://bugs.launchpad.net/mysql-server/+bug/1588845/+subscriptions


Follow ups