|
cURL Mailing List Monthly Index Single Mail
curl-tracker Archives
[curl:bugs] #1362 Increment the initialized counter in curl_global_init_mem()
From: Tristan <tristanmx_at_users.sf.net>
Date: Fri, 18 Apr 2014 14:55:29 +0000
Hello,
After doing some more tests, the use case I described yesterday is actually not producing the libc assert. I thought that the cleanup set the default memory manager back, but it's not (which in fact seems ok to me).
I guess the fix I suggested is still legit, but for information, here is the use case producing the assert :
I didn't know where the default memory managers were set back, and I just discovered the step 4 in my code and that it was calling curl_global_init().
Sorry for the wrong use case from yesterday
--- ** [bugs:#1362] Increment the initialized counter in curl_global_init_mem()** **Status:** open **Labels:** curl_global_init_mem **Created:** Thu Apr 17, 2014 09:28 PM UTC by Tristan **Last Updated:** Thu Apr 17, 2014 09:28 PM UTC **Owner:** nobody Hello, I think there is an issue in easy.c, in the curl_global_init_mem() function The initialized counter is not incremented if the libcurl is already initialized. I'm currently doing two inits and two shutdowns, and here is the problem I met : 1) curl_global_init_mem(); // Actually initialize libcurl (initialized = 1) 2) curl_global_init_mem(); // Should do nothing (initialized stays to 1 instead of being incremented) 3) curl_global_cleanup(); // Actually cleanup libcurl because initialized = 1 4) curl_global_cleanup(); After step 3 the variables that were created using the custom malloc are released using the default free, which raises an assert by libc on non-matching heap : Invalid address specified to RtlValidateHeap I could fix that by modifying easy.c the following way: @@ -300,8 +300,10 @@ return CURLE_FAILED_INIT; /* Already initialized, don't do it again */ - if(initialized) + if(initialized) { + initialized++; return CURLE_OK; + } /* Call the actual init function first */ code = curl_global_init(flags); However, maybe there is a better fix than duplicating the increment from curl_global_init()? I'm using Libcurl 7.34.0, and checked quickly for a fix in 7.36.0, but I didn't find it. --- Sent from sourceforge.net because curl-tracker@cool.haxx.se is subscribed to https://sourceforge.net/p/curl/bugs/ To unsubscribe from further messages, a project admin can change settings at https://sourceforge.net/p/curl/admin/bugs/options. Or, if this is a mailing list, you can unsubscribe from the mailing list.Received on 2014-04-18 These mail archives are generated by hypermail. |
Page updated March 21, 2014.
web site info