Date: Tue, 9 Jan 2024 13:30:19 GMT From: Olivier Certner <olce@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: 15bb0300eeca - main - libhtr: pthread_attr_setaffinity_np(): Replace calloc() with malloc() Message-ID: <202401091330.409DUJXu035793@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=15bb0300eeca233827a6a13cd2ed883e0034979d commit 15bb0300eeca233827a6a13cd2ed883e0034979d Author: Olivier Certner <olce@FreeBSD.org> AuthorDate: 2024-01-04 15:20:50 +0000 Commit: Olivier Certner <olce@FreeBSD.org> CommitDate: 2024-01-09 13:29:26 +0000 libhtr: pthread_attr_setaffinity_np(): Replace calloc() with malloc() Using calloc() instead of malloc() is useless here since the allocated memory is to be wholly crushed by the memcpy() call that follows. Suggested by: kib Reviewed by: emaste, kib Approved by: emaste (mentor) MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D43328 --- lib/libthr/thread/thr_attr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/libthr/thread/thr_attr.c b/lib/libthr/thread/thr_attr.c index bbb143da1a7d..561037fa5eb4 100644 --- a/lib/libthr/thread/thr_attr.c +++ b/lib/libthr/thread/thr_attr.c @@ -551,7 +551,7 @@ _pthread_attr_setaffinity_np(pthread_attr_t *pattr, size_t cpusetsize, return (EINVAL); } if (attr->cpuset == NULL) { - attr->cpuset = calloc(1, kern_size); + attr->cpuset = malloc(kern_size); if (attr->cpuset == NULL) return (errno); attr->cpusetsize = kern_size;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202401091330.409DUJXu035793>