Memory Leak using CertOpenStore on Windows 2008 R2


i have program (runs both 32 , 64 bit ) when using certopenstore results in memory leak on windows 2008 r2 (i haven't tried 2012, code has run years on 2000, 2003, 2008 without issues)

sample code reproduce issue:

int main( int argc, char** argv )  {  	hcertstore store;  	int go = 1;    	while( go ){  		store = certopenstore(   				cert_store_prov_system_a,   				0,   				0,  				cert_system_store_local_machine | cert_store_open_existing_flag,  				"my" );  		if( store ){  			//if( !certclosestore( store , cert_close_store_check_flag ) ){  			if( !certclosestore( store , cert_close_store_force_flag ) ){  				if( getlasterror() == crypt_e_pending_close ){  					printf( "!" );  				}  				else{  					go = 0;  				}  			}  		}  		else{  			go = 0;  		}  		sleep( 10 );  	}  	return 0;  }

the callstack allocations pretty  (this 32 bit process on 2008r2 box)

      heap_entry size prev flags    userptr usersize - state
        02e75af0 000f 0000  [00]   02e75b08    0005e - (busy)
        7724dff2 ntdll!rtlallocateheap+0x00000274
        745f6017 aclayers!malloc+0x00000079
        7460dc96 aclayers!ns_virtualregistry::makepath+0x00000056
        7460e817 aclayers!ns_virtualregistry::cvirtualregistry::openkeyw+0x000000a9
        7460f21a aclayers!ns_virtualregistry::apihook_regopenkeyexw+0x00000036
        743d2641 acgenral!ns_wrpmitigation::apihook_regopenkeyexw+0x00000024
        7527a246 crypt32!regopenhkcukeyexu+0x00000055
        7527de26 crypt32!opensubkeyex+0x00000108
        7527e4d8 crypt32!opensubkey+0x00000015
        7527ed88 crypt32!opensystemregpathkey+0x00000033
        75281a2f crypt32!enumphysicalstore+0x00000162
        75281d0e crypt32!i_certdllopensystemstoreprovw+0x0000015c
        752c9fce crypt32!i_certdllopensystemstoreprova+0x0000006c
        7527e49a crypt32!certopenstore+0x0000010e

anyone have ideas of hotfix available this?

thanks

might ask them here this.

windows desktop dev forums on msdn

 

 

 


regards, dave patrick ....
microsoft certified professional
microsoft mvp [windows]

disclaimer: posting provided "as is" no warranties or guarantees , , confers no rights.



Windows Server  >  Windows Server General Forum



Comments

Popular posts from this blog

2008 Windows Deployment Server Properties Error

Can no longer user MS Update - Files required to use Microsoft Update are no longer registered

How do a find data in one file, search for it in another file and if not found, write a custom message to another file