mirror of
https://github.com/systemd/systemd.git
synced 2024-10-31 07:51:21 +03:00
tree-wide: use reallocarray() where appropriate
This commit is contained in:
parent
0c21dafb54
commit
a7798cd81b
@ -675,7 +675,7 @@ static int insert_into_order(uint16_t slot, bool first) {
|
||||
}
|
||||
|
||||
/* extend array */
|
||||
t = realloc(order, (n + 1) * sizeof(uint16_t));
|
||||
t = reallocarray(order, n + 1, sizeof(uint16_t));
|
||||
if (!t)
|
||||
return -ENOMEM;
|
||||
order = t;
|
||||
|
@ -818,7 +818,7 @@ _public_ int sd_get_uids(uid_t **users) {
|
||||
uid_t *t;
|
||||
|
||||
n = MAX(16, 2*r);
|
||||
t = realloc(l, sizeof(uid_t) * n);
|
||||
t = reallocarray(l, sizeof(uid_t), n);
|
||||
if (!t)
|
||||
return -ENOMEM;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user