diff options
author | unknown <brian@zim.(none)> | 2007-01-31 20:13:17 -0800 |
---|---|---|
committer | unknown <brian@zim.(none)> | 2007-01-31 20:13:17 -0800 |
commit | f1be406368ccb88f6454555388dcc8bb505db7c4 (patch) | |
tree | 5d9313b3ca61fd58f66cf8fb712a2c5c9add8da9 /storage/archive | |
parent | c6c436f8bd316f6aec2ddaa617ba49908d865969 (diff) | |
download | mariadb-git-f1be406368ccb88f6454555388dcc8bb505db7c4.tar.gz |
Reworked a section of code that caused valgrind errors (and that partitioning was not happy about).
storage/archive/ha_archive.cc:
Put checks around the code
Diffstat (limited to 'storage/archive')
-rw-r--r-- | storage/archive/ha_archive.cc | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/storage/archive/ha_archive.cc b/storage/archive/ha_archive.cc index 50abea9b664..4108bb32a07 100644 --- a/storage/archive/ha_archive.cc +++ b/storage/archive/ha_archive.cc @@ -627,13 +627,20 @@ int ha_archive::create(const char *name, TABLE *table_arg, /* Here is where we open up the frm and pass it to archive to store */ - frm_file= my_open(name_buff, O_RDONLY, MYF(0)); - VOID(my_fstat(frm_file, &file_stat, MYF(MY_WME))); - frm_ptr= (byte *)my_malloc(sizeof(byte) * file_stat.st_size , MYF(0)); - my_read(frm_file, frm_ptr, file_stat.st_size, MYF(0)); - azwrite_frm(&create_stream, (char *)frm_ptr, file_stat.st_size); - my_close(frm_file, MYF(0)); - my_free((gptr)frm_ptr, MYF(0)); + if ((frm_file= my_open(name_buff, O_RDONLY, MYF(0))) > 0) + { + if (!my_fstat(frm_file, &file_stat, MYF(MY_WME))) + { + frm_ptr= (byte *)my_malloc(sizeof(byte) * file_stat.st_size , MYF(0)); + if (frm_ptr) + { + my_read(frm_file, frm_ptr, file_stat.st_size, MYF(0)); + azwrite_frm(&create_stream, (char *)frm_ptr, file_stat.st_size); + my_free((gptr)frm_ptr, MYF(0)); + } + } + my_close(frm_file, MYF(0)); + } if (create_info->comment.str) azwrite_comment(&create_stream, create_info->comment.str, |