Skip to content

Commit

Permalink
Pull request #174: problem is malloc
Browse files Browse the repository at this point in the history
Fix bug in pull request #170

Squashed commit of the following:

commit d9b46cf6f7de2088187f48722de2313d1d0d32ca
Author: van Andel, Gerhard <gvanande@ball.com>
Date:   Tue Aug 24 17:39:50 2021 -0600

    problem is malloc
  • Loading branch information
van Andel, Gerhard committed Aug 24, 2021
1 parent 4690fa0 commit 9d3c9dc
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion cosmos/ext/cosmos/ext/structure/structure.c
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,7 @@ static VALUE binary_accessor_read(VALUE self, VALUE param_bit_offset, VALUE para
{
string_length = upper_bound - lower_bound + 1;
string = malloc(string_length + 1);
if (unsigned_char_array == NULL) {
if (string == NULL) {
rb_raise(rb_eNoMemError, "malloc of %d returned NULL", string_length + 1);
}
memcpy(string, buffer + lower_bound, string_length);
Expand Down

0 comments on commit 9d3c9dc

Please sign in to comment.