3715 Tor Didriksen 2012-03-06
Bug#13810145 FIX WARNINGS BY FORTIFY
Fortify reports lots of warnings:
"Use After Free"
"Double Free"
"Memory Leak"
@ mysys/my_lib.c
Try to help fortify flow analysis:
if we do my_malloc() here, we are guaranteed to do my_free() as well.
@ sql/net_serv.cc
Try to help fortify flow analysis:
if we do my_malloc() here, we are guaranteed to do my_free() as well.
modified:
mysys/my_lib.c
sql/net_serv.cc
3714 Marc Alff 2012-03-05 [merge]
Local merge
modified:
mysql-test/suite/rpl/r/rpl_mts_debug.result
mysql-test/suite/rpl/t/rpl_mts_debug.test
mysql-test/suite/sys_vars/r/slave_checkpoint_group_basic.result
sql/rpl_rli_pdb.cc
sql/rpl_slave.cc
sql/rpl_slave.h
=== modified file 'mysys/my_lib.c'
--- a/mysys/my_lib.c 2011-11-28 07:13:03 +0000
+++ b/mysys/my_lib.c 2012-03-06 07:07:57 +0000
@@ -402,12 +402,12 @@ int my_fstat(File Filedes, MY_STAT *stat
MY_STAT *my_stat(const char *path, MY_STAT *stat_area, myf my_flags)
{
- int m_used;
+ const int m_used= (stat_area == NULL);
DBUG_ENTER("my_stat");
DBUG_PRINT("my", ("path: '%s' stat_area: 0x%lx MyFlags: %d", path,
(long) stat_area, my_flags));
- if ((m_used= (stat_area == NULL)))
+ if (m_used)
if (!(stat_area= (MY_STAT *) my_malloc(sizeof(MY_STAT), my_flags)))
goto error;
#ifndef _WIN32
=== modified file 'sql/net_serv.cc'
--- a/sql/net_serv.cc 2011-11-03 16:03:34 +0000
+++ b/sql/net_serv.cc 2012-03-06 07:07:57 +0000
@@ -609,7 +609,8 @@ net_write_packet(NET *net, const uchar *
net->reading_or_writing= 2;
#ifdef HAVE_COMPRESS
- if (net->compress)
+ const bool do_compress= net->compress;
+ if (do_compress)
{
if ((packet= compress_packet(net, packet, &length)) == NULL)
{
@@ -629,7 +630,7 @@ net_write_packet(NET *net, const uchar *
res= net_write_raw_loop(net, packet, length);
#ifdef HAVE_COMPRESS
- if (net->compress)
+ if (do_compress)
my_free((void *) packet);
#endif
No bundle (reason: useless for push emails).
| Thread |
|---|
| • bzr push into mysql-trunk branch (tor.didriksen:3714 to 3715) Bug#13810145 | Tor Didriksen | 6 Mar |