Supun Kamburugamuva wrote:
Hi,We use a ref count to keep track of the references to a openssl_pkey_t and use it in the openssl_pkey_free method. In the openssl_pkey_create method we are setting the ref count to 0. But since we are returning a pointer, ref count should be set to 1. Also the free method assumes that in the create method it will be set to one. This is the code in the free method. if(--(pkey->ref) > 0){ return AXIS2_SUCCESS ; } Now lets assume we are having two pointers to the structure. One pointer is created when the structure is create and other is when we copy the pointer. But now our ref counter is 1 (In create method we set it to 0). Lets say we free those two pointers respectively. In both these free method calls the above if statement will return false and the structure will be free twice (double free). So we need to set the ref = 1 in the openssl_pkey_create methods?
+1. One other possibility is to increase reference just after creating. This is how all the other references are working. But I prefer to do that in Create method itself.
Regards, Shankar.
Any comments? Supun..
