From a7798cd81b11205811e8d6e848e23b8b285f2bd8 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Tue, 2 Apr 2019 14:50:15 +0200 Subject: tree-wide: use reallocarray() where appropriate --- src/boot/bootctl.c | 2 +- src/libsystemd/sd-login/sd-login.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/boot/bootctl.c b/src/boot/bootctl.c index 381c234f3b..a7de3800fc 100644 --- a/src/boot/bootctl.c +++ b/src/boot/bootctl.c @@ -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; diff --git a/src/libsystemd/sd-login/sd-login.c b/src/libsystemd/sd-login/sd-login.c index 07f21e84de..0dc368e6e2 100644 --- a/src/libsystemd/sd-login/sd-login.c +++ b/src/libsystemd/sd-login/sd-login.c @@ -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; -- cgit v1.2.1