Skip to content

Commit

Permalink
Correct asprintf error detection
Browse files Browse the repository at this point in the history
  • Loading branch information
hacatu committed Feb 12, 2024
1 parent b7e2bf1 commit b293210
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/test/vec_oom.c
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,8 @@ int main(){
status = cr8r_vec_init(&vec, &ft, 8);
for(uint64_t i = 0; status && i < vec.cap; ++i){
char *cstr = NULL;
asprintf(&cstr, "a%"PRIu64, i + 666);
status = !!cstr && cr8r_vec_pushr(&vec, &ft, &cstr);
status = asprintf(&cstr, "a%"PRIu64, i + 666) != -1;
status = status && !!cstr && cr8r_vec_pushr(&vec, &ft, &cstr);
}
if(!status){
fprintf(stderr, "\e[1;31mERROR: failed to initialize cstr vec!\e[0m\n");
Expand Down

0 comments on commit b293210

Please sign in to comment.