coccinelle: add reallocarray() coccinelle script
Let's systematically make use of reallocarray() whereever we invoke realloc() with a product of two values.
This commit is contained in:
+1
-1
@@ -173,7 +173,7 @@ int prioq_put(Prioq *q, void *data, unsigned *idx) {
|
||||
struct prioq_item *j;
|
||||
|
||||
n = MAX((q->n_items+1) * 2, 16u);
|
||||
j = realloc(q->items, sizeof(struct prioq_item) * n);
|
||||
j = reallocarray(q->items, n, sizeof(struct prioq_item));
|
||||
if (!j)
|
||||
return -ENOMEM;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user