Skip to content

Commit

Permalink
Merge branch 'AigarsG-dictionary_new_calloc_checks'
Browse files Browse the repository at this point in the history
  • Loading branch information
lmoellendorf committed Apr 7, 2024
2 parents b726472 + 6fc4ec0 commit f00e027
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/dictionary.c
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,13 @@ dictionary * dictionary_new(size_t size)
d->val = (char**) calloc(size, sizeof *d->val);
d->key = (char**) calloc(size, sizeof *d->key);
d->hash = (unsigned*) calloc(size, sizeof *d->hash);
if (!d->size || !d->val || !d->hash) {
free((void *) d->size);
free((void *) d->val);
free((void *) d->hash);
free(d);
d = NULL;
}
}
return d ;
}
Expand Down

0 comments on commit f00e027

Please sign in to comment.