Skip to content

Commit

Permalink
Fix memory issue on resizing dset to zero
Browse files Browse the repository at this point in the history
  • Loading branch information
mattjala committed Oct 6, 2023
1 parent 677bc83 commit 864d7f0
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/rest_vol_dataset.c
Original file line number Diff line number Diff line change
Expand Up @@ -1510,7 +1510,16 @@ RV_dataset_specific(void *obj, H5VL_dataset_specific_args_t *args, hid_t dxpl_id
/* N bytes needed to store an N digit number,
* floor(log10) + 1 of an N digit number is >= N,
* plus two bytes for space and comma characters in the list */
request_body_shape_size += floor(log10((double)new_extent[i])) + 1 + 2;
size_t num_digits = 0;

if (new_extent[i] == 0) {
num_digits = 1;
}
else {
num_digits = floor(log10((double)new_extent[i]));
}

request_body_shape_size += num_digits + 1 + 2;
}

if ((request_body = RV_malloc(request_body_shape_size + strlen(fmt_string) + 1)) == NULL)
Expand Down

0 comments on commit 864d7f0

Please sign in to comment.