fixed a critical bug where data size was not calculated correctly and
column directory is now closed when column is closed
This commit is contained in:
@ -907,8 +907,9 @@ OBIDMS_column_p obi_open_column(OBIDMS_p dms,
|
|||||||
// TODO Check endianness?
|
// TODO Check endianness?
|
||||||
|
|
||||||
// Compute data size from the informations in the header
|
// Compute data size from the informations in the header
|
||||||
data_size = ((column->header)->line_count) * sizeof((column->header)->data_type);
|
data_size = obi_array_sizeof((column->header)->data_type, (column->header)->line_count, (column->header)->nb_elements_per_line);
|
||||||
|
|
||||||
|
// Map the data
|
||||||
column->data = mmap(NULL,
|
column->data = mmap(NULL,
|
||||||
data_size,
|
data_size,
|
||||||
PROT_READ,
|
PROT_READ,
|
||||||
@ -1009,7 +1010,7 @@ int obi_close_column(OBIDMS_column_p column)
|
|||||||
size_t data_size;
|
size_t data_size;
|
||||||
|
|
||||||
// Munmap data
|
// Munmap data
|
||||||
data_size = (column->header)->line_count * (column->header)->nb_elements_per_line * sizeof((column->header)->data_type);
|
data_size = obi_array_sizeof((column->header)->data_type, (column->header)->line_count, (column->header)->nb_elements_per_line);
|
||||||
if (munmap(column->data, data_size) < 0)
|
if (munmap(column->data, data_size) < 0)
|
||||||
{
|
{
|
||||||
obi_set_errno(OBICOL_UNKNOWN_ERROR);
|
obi_set_errno(OBICOL_UNKNOWN_ERROR);
|
||||||
@ -1025,6 +1026,8 @@ int obi_close_column(OBIDMS_column_p column)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
obi_close_column_directory(column->column_directory);
|
||||||
|
|
||||||
free(column);
|
free(column);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
Reference in New Issue
Block a user