Loading...
libkern/c++/OSRuntime.cpp xnu-792.6.61 xnu-344.23
--- xnu/xnu-792.6.61/libkern/c++/OSRuntime.cpp
+++ xnu/xnu-344.23/libkern/c++/OSRuntime.cpp
@@ -67,7 +67,7 @@
 #endif
 
 	mem->mlen = memsize;
-	bzero( mem->dat, size);
+	(void) memset(mem->dat, 0, size);
 
 	return  (mem->dat);
 }
@@ -89,7 +89,7 @@
 #if 0
 	memset((vm_offset_t)hdr, 0xbb, hdr->mlen);
 #else
-	kfree(hdr, hdr->mlen);
+	kfree((vm_offset_t)hdr, hdr->mlen);
 #endif
 }
 
@@ -130,7 +130,7 @@
 		(void) memset(&nmem->dat[osize], 0, nsize - osize);
 	(void) memcpy(nmem->dat, ohdr->dat,
 					(nsize > osize) ? osize : nsize);
-	kfree(ohdr, ohdr->mlen);
+	kfree((vm_offset_t)ohdr, ohdr->mlen);
 
 	return (nmem->dat);
 }
@@ -155,11 +155,7 @@
 
 typedef void (*structor_t)(void);
 
-// Given a pointer to a 32 bit mach object segment, iterate the segment to
-// obtain a 32 bit destructor section for C++ objects, and call each of the
-// destructors there.
-void
-OSRuntimeUnloadCPPForSegment(struct segment_command * segment) {
+void OSRuntimeUnloadCPPForSegment(struct segment_command * segment) {
 
     struct section * section;
 
@@ -183,7 +179,6 @@
     return;
 }
 
-// This function will only operate on 32 bit kmods
 void OSRuntimeUnloadCPP(kmod_info_t *ki, void *)
 {
     if (ki && ki->address) {
@@ -226,7 +221,6 @@
 }
 
 // Functions used by the extenTools/kmod library project
-// This function will only operate on 32 bit kmods
 kern_return_t OSRuntimeInitializeCPP(kmod_info_t *ki, void *)
 {
     struct mach_header *header;
@@ -334,6 +328,8 @@
     void * result;
 
     result = (void *) kern_os_malloc( size);
+    if( result)
+	bzero( result, size);
     return( result);
 }