Neil Horman ce6702
diff -up numactl-2.0.3/libnuma.c.orig numactl-2.0.3/libnuma.c
Neil Horman ce6702
--- numactl-2.0.3/libnuma.c.orig	2009-08-10 09:59:24.000000000 -0400
Neil Horman ce6702
+++ numactl-2.0.3/libnuma.c	2009-08-10 10:00:40.000000000 -0400
Neil Horman ce6702
@@ -95,6 +95,19 @@ numa_init(void)
Neil Horman ce6702
 	memset(&numa_no_nodes, 0, sizeof(numa_no_nodes));
Neil Horman ce6702
 }
Neil Horman ce6702
 
Neil Horman ce6702
+void
Neil Horman ce6702
+numa_fini(void)
Neil Horman ce6702
+{
Neil Horman ce6702
+	if (numa_all_cpus_ptr)
Neil Horman ce6702
+		numa_bitmask_free(numa_all_cpus_ptr);
Neil Horman ce6702
+	if (numa_all_nodes_ptr)
Neil Horman ce6702
+		numa_bitmask_free(numa_all_nodes_ptr);
Neil Horman ce6702
+	if (numa_no_nodes_ptr)
Neil Horman ce6702
+		numa_bitmask_free(numa_no_nodes_ptr);
Neil Horman ce6702
+	if (nodes_allowed_list)
Neil Horman ce6702
+		free(nodes_allowed_list);
Neil Horman ce6702
+}
Neil Horman ce6702
+
Neil Horman ce6702
 /*
Neil Horman ce6702
  * The following bitmask declarations, bitmask_*() routines, and associated
Neil Horman ce6702
  * _setbit() and _getbit() routines are:
Neil Horman ce6702
diff -up numactl-2.0.3/Makefile.orig numactl-2.0.3/Makefile
Neil Horman ce6702
--- numactl-2.0.3/Makefile.orig	2009-06-10 08:30:03.000000000 -0400
Neil Horman ce6702
+++ numactl-2.0.3/Makefile	2009-08-10 10:00:00.000000000 -0400
Neil Horman ce6702
@@ -81,7 +81,7 @@ stream_main.o: stream_main.c
Neil Horman ce6702
 libnuma.so.1: versions.ldscript
Neil Horman ce6702
 
Neil Horman ce6702
 libnuma.so.1: libnuma.o syscall.o distance.o
Neil Horman ce6702
-	${CC} ${LDFLAGS} -shared -Wl,-soname=libnuma.so.1 -Wl,--version-script,versions.ldscript -Wl,-init,numa_init -o libnuma.so.1 $(filter-out versions.ldscript,$^)
Neil Horman ce6702
+	${CC} ${LDFLAGS} -shared -Wl,-soname=libnuma.so.1 -Wl,--version-script,versions.ldscript -Wl,-init,numa_init -Wl,-fini,numa_fini -o libnuma.so.1 $(filter-out versions.ldscript,$^)
Neil Horman ce6702
 
Neil Horman ce6702
 libnuma.so: libnuma.so.1
Neil Horman ce6702
 	ln -sf libnuma.so.1 libnuma.so