Skip to content

Commit

Permalink
Fix use-after-free warning (fixes #273)
Browse files Browse the repository at this point in the history
  • Loading branch information
evanmiller committed May 12, 2022
1 parent 90250be commit c73005e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/sas/readstat_sas7bdat_read.c
Original file line number Diff line number Diff line change
Expand Up @@ -703,7 +703,6 @@ static readstat_variable_t *sas7bdat_init_variable(sas7bdat_ctx_t *ctx, int i,

cleanup:
if (retval != READSTAT_OK) {
free(variable);
if (out_retval)
*out_retval = retval;

Expand All @@ -716,6 +715,8 @@ static readstat_variable_t *sas7bdat_init_variable(sas7bdat_ctx_t *ctx, int i,
}
}

free(variable);

return NULL;
}

Expand Down

1 comment on commit c73005e

@usta
Copy link

@usta usta commented on c73005e May 12, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@evanmiller thank you for this patch , and i think this patch is also needed to be noted in NEWS.md

Please sign in to comment.