Skip to content

Commit

Permalink
fix transposed arguments to calloc()
Browse files Browse the repository at this point in the history
calloc() wants the number of members followed by the
size of each member. obviously the product is the same
either way, but there could be alignment problems if
the arguments are transposed, as they were here.
  • Loading branch information
dankamongmen committed Oct 2, 2024
1 parent f21c3be commit 51f473a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/lib/render.c
Original file line number Diff line number Diff line change
Expand Up @@ -580,7 +580,7 @@ int ncplane_mergedown(ncplane* restrict src, ncplane* restrict dst,
return -1;
}
const int totalcells = dst->leny * dst->lenx;
nccell* rendfb = calloc(sizeof(*rendfb), totalcells);
nccell* rendfb = calloc(totalcells, sizeof(*rendfb));
const size_t crenderlen = sizeof(struct crender) * totalcells;
struct crender* rvec = malloc(crenderlen);
if(!rendfb || !rvec){
Expand Down

0 comments on commit 51f473a

Please sign in to comment.