From: Lennart Poettering Date: Tue, 2 Apr 2019 12:50:15 +0000 (+0200) Subject: tree-wide: use reallocarray() where appropriate X-Git-Tag: v242-rc1~4^2~6 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=a7798cd81b11205811e8d6e848e23b8b285f2bd8;p=thirdparty%2Fsystemd.git tree-wide: use reallocarray() where appropriate --- diff --git a/src/boot/bootctl.c b/src/boot/bootctl.c index 381c234f3b0..a7de3800fcf 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 07f21e84de5..0dc368e6e25 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;