summaryrefslogtreecommitdiffstats
path: root/c++/src/H5DataSet.cpp
diff options
context:
space:
mode:
authorMohamad Chaarawi <chaarawi@hdfgroup.org>2014-04-01 15:42:43 (GMT)
committerMohamad Chaarawi <chaarawi@hdfgroup.org>2014-04-01 15:42:43 (GMT)
commit72e8017eadf211257caceb43095b2aed76e81632 (patch)
tree0fae8d91bc2587a7b3b44129c5afaf37d4842098 /c++/src/H5DataSet.cpp
parentd4c2e51d1e255fde2c0b2e359078cfd0de82720a (diff)
parentc86aedeba1f683daaf0289435450fd4e518fecc4 (diff)
downloadhdf5-72e8017eadf211257caceb43095b2aed76e81632.zip
hdf5-72e8017eadf211257caceb43095b2aed76e81632.tar.gz
hdf5-72e8017eadf211257caceb43095b2aed76e81632.tar.bz2
[svn-r24940] merge from trunk.
Diffstat (limited to 'c++/src/H5DataSet.cpp')
-rw-r--r--c++/src/H5DataSet.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/c++/src/H5DataSet.cpp b/c++/src/H5DataSet.cpp
index 0722ef9..699f982 100644
--- a/c++/src/H5DataSet.cpp
+++ b/c++/src/H5DataSet.cpp
@@ -629,7 +629,7 @@ hid_t DataSet::getId() const
//--------------------------------------------------------------------------
// Function: DataSet::p_read_fixed_len (private)
-// brief Reads a fixed length \a H5std_string from an dataset.
+// brief Reads a fixed length \a H5std_string from a dataset.
// param mem_type - IN: DataSet datatype (in memory)
// param strg - IN: Buffer for read string
// exception H5::DataSetIException
@@ -643,14 +643,14 @@ void DataSet::p_read_fixed_len(const hid_t mem_type_id, const hid_t mem_space_id
// Only allocate for fixed-len string.
// Get the size of the dataset's data
- size_t attr_size = getInMemDataSize();
+ size_t data_size = getInMemDataSize();
// If there is data, allocate buffer and read it.
- if (attr_size > 0)
+ if (data_size > 0)
{
- char *strg_C = NULL;
+ char *strg_C = new char [data_size+1];
+ HDmemset(strg_C, 0, data_size+1); // clear buffer
- strg_C = new char [(size_t)attr_size+1];
herr_t ret_value = H5Dread(id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, strg_C);
if( ret_value < 0 )