mkimg(1): let calloc(3) do the multiplication.
Reviewed by: marcel MFC after: 1 week
This commit is contained in:
parent
bba279e552
commit
6613eaa42b
@ -216,7 +216,7 @@ qcow_write(int fd, u_int version)
|
||||
ofs = clstrsz * l2clno;
|
||||
nclstrs = 1 + clstr_l1tblsz + clstr_rctblsz;
|
||||
|
||||
l1tbl = calloc(1, clstrsz * clstr_l1tblsz);
|
||||
l1tbl = calloc(clstr_l1tblsz, clstrsz);
|
||||
if (l1tbl == NULL) {
|
||||
error = ENOMEM;
|
||||
goto out;
|
||||
@ -247,7 +247,7 @@ qcow_write(int fd, u_int version)
|
||||
} while (n < clstr_rcblks);
|
||||
|
||||
if (rcclno > 0) {
|
||||
rctbl = calloc(1, clstrsz * clstr_rctblsz);
|
||||
rctbl = calloc(clstr_rctblsz, clstrsz);
|
||||
if (rctbl == NULL) {
|
||||
error = ENOMEM;
|
||||
goto out;
|
||||
@ -297,7 +297,7 @@ qcow_write(int fd, u_int version)
|
||||
l1tbl = NULL;
|
||||
|
||||
if (rcclno > 0) {
|
||||
rcblk = calloc(1, clstrsz * clstr_rcblks);
|
||||
rcblk = calloc(clstr_rcblks, clstrsz);
|
||||
if (rcblk == NULL) {
|
||||
error = ENOMEM;
|
||||
goto out;
|
||||
|
Loading…
Reference in New Issue
Block a user