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

(cherry picked from commit 15bb0300eeca233827a6a13cd2ed883e0034979d)

Approved by:            markj (mentor)
This commit is contained in:
Olivier Certner 2024-01-04 16:20:50 +01:00
parent a431d0f4a2
commit 194df67ef5
No known key found for this signature in database
GPG key ID: 8CA13040971E2627

View file

@ -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;