Skip to content

Commit

Permalink
Another malloc fix
Browse files Browse the repository at this point in the history
  • Loading branch information
slobodan-ilic committed Jun 13, 2024
1 parent 481a7d1 commit ec778f5
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/spss/readstat_sav_read.c
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,10 @@ static readstat_error_t sav_read_multiple_response_sets(size_t data_len, sav_ctx
char *token = strtok(mr_string, "$\n");
int num_lines = 0;
while (token != NULL) {
ctx->mr_sets = realloc(ctx->mr_sets, (num_lines + 1) * sizeof(mr_set_t));
if ((ctx->mr_sets = realloc(ctx->mr_sets, (num_lines + 1) * sizeof(mr_set_t))) == NULL) {
retval = READSTAT_ERROR_MALLOC;
goto cleanup;
}
retval = parse_mr_line(token, &ctx->mr_sets[num_lines]);
if (retval != READSTAT_OK) goto cleanup;
num_lines++;
Expand Down

0 comments on commit ec778f5

Please sign in to comment.