Skip to content

Commit e38316f

Browse files
committed
cpukinds: fix register() after dup()
Properly initialize nr_cpukinds_allocated in dup() so that future extensions don't break. Thansk to Hadrien Grasland for the report. Closes #683. Signed-off-by: Brice Goglin <[email protected]>
1 parent 8716dc2 commit e38316f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

hwloc/cpukinds.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright © 2020-2023 Inria. All rights reserved.
2+
* Copyright © 2020-2024 Inria. All rights reserved.
33
* See COPYING in top-level directory.
44
*/
55

@@ -50,6 +50,7 @@ hwloc_internal_cpukinds_dup(hwloc_topology_t new, hwloc_topology_t old)
5050
return -1;
5151
new->cpukinds = kinds;
5252
new->nr_cpukinds = old->nr_cpukinds;
53+
new->nr_cpukinds_allocated = old->nr_cpukinds;
5354
memcpy(kinds, old->cpukinds, old->nr_cpukinds * sizeof(*kinds));
5455

5556
for(i=0;i<old->nr_cpukinds; i++) {

0 commit comments

Comments
 (0)