|
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: Tue, 22 Apr 2014 14:23:14 +0000
Hello Mr. Stenberg,
Thank you for your answer.
Indeed there should be a better fix than this one.
Is it correct if I say that after each call to curl_global_init_mem(), the initialized variable should have its value incremented?
The suggested fix is not very good since it would be better that the initialized variable would be updated only in curl_global_init() and curl_global_cleanup(), but is this fix wrong or just not good?
--- ** [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:** Mon Apr 21, 2014 06:28 PM UTC **Owner:** Daniel Stenberg 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-22 These mail archives are generated by hypermail. |
Page updated March 21, 2014.
web site info