c - error ssl with threads -


i have following code (some irrelevant parts removed)

ssl_method *meth = null; ssl_ctx *ctx = null; ssl *ssl = null; bio *sbio; //open socket int sock = open_port(ip,80); if(sock == -1)     return -1; meth=sslv23_client_method(); openssl_add_ssl_algorithms(); ctx=ssl_ctx_new(meth); /* connect ssl socket */ ssl=ssl_new(ctx); sbio=bio_new_socket(sock,bio_noclose); ssl_set_bio(ssl,sbio,sbio); if(ssl_connect(ssl)<=0) {     ssl_free(ssl);     ssl_ctx_free(ctx);     return -1; }  //ssl write & read part  ssl_shutdown(ssl); ssl_free(ssl); ssl_ctx_free(ctx); //close socket close(sock); 

this function every thread calling ssl connection , works fine except after running while following error:

*** glibc detected *** test: double free or corruption (fasttop): 0xc4813440 *** *** glibc detected *** test: double free or corruption (!prev): 0x096008b0 *** 

*which functions between ssl_free , ssl_ctx_free should not use ? or error somewhere else?*


Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -