Description:
Memory for unique_tmp_file_name is allocated via my_malloc but not freed if mysql_file_create failed to write into the slave_load_tmpdir.
[ERROR] Slave SQL: Unable to use slave's temporary directory /slavetmp - Can't create/write to file '/slavetmp/SQL_LOAD-3b51bb28-d727-11e3-9464-08002705be5e' (Errcode: 13 - Permission denied), Error_code: 1
==31785== 586 bytes in 1 blocks are definitely lost in loss record 1 of 1
==31785== at 0x4A078E4: malloc (vg_replace_malloc.c:291)
==31785== by 0x8CF5F4: my_malloc (my_malloc.c:38)
==31785== by 0x89F356: handle_slave_sql (rpl_slave.cc:4570)
==31785== by 0x3FF8E07D13: start_thread (pthread_create.c:309)
==31785== by 0x35372F168C: clone (clone.S:115)
How to repeat:
read the code
Suggested fix:
=== modified file 'sql/rpl_slave.cc'
--- sql/rpl_slave.cc 2014-05-08 12:47:46 +0000
+++ sql/rpl_slave.cc 2014-05-09 08:34:04 +0000
@@ -4571,6 +4571,7 @@
unique_tmp_file_name, CREATE_MODE,
O_WRONLY | O_BINARY | O_EXCL | O_NOFOLLOW,
MYF(MY_WME))) < 0)
+ my_free(unique_tmp_file_name);
DBUG_RETURN(1);
/*