]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
tree-wide: use reallocarray() where appropriate
authorLennart Poettering <lennart@poettering.net>
Tue, 2 Apr 2019 12:50:15 +0000 (14:50 +0200)
committerLennart Poettering <lennart@poettering.net>
Tue, 2 Apr 2019 12:54:42 +0000 (14:54 +0200)
src/boot/bootctl.c
src/libsystemd/sd-login/sd-login.c

index 381c234f3b0e5d24167c802ba967e05fe50d7278..a7de3800fcf1a31131299fe6cdb7b652ea69bcf3 100644 (file)
@@ -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;
index 07f21e84de534cfcea365915545995f03cb38d36..0dc368e6e25f69d27df834216373629a3a89321a 100644 (file)
@@ -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;