aboutsummaryrefslogtreecommitdiff
path: root/lib/easy.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2014-04-22 22:56:59 +0200
committerDaniel Stenberg <daniel@haxx.se>2014-04-22 23:08:14 +0200
commit5b463e97fa5ceaf058a3197ab89e15fcb4dd9160 (patch)
treee0e060782c14f7e44a981f1ab6f844aed93ab7a8 /lib/easy.c
parent8868a226cdad66a9a07d6e3f168884817592a1df (diff)
curl_global_init_mem: bump initialized even if already initialized
As this makes curl_global_init_mem() behave the same way as curl_global_init() already does in that aspect - the same number of curl_global_cleanup() calls is then required to again decrease the counter and then eventually do the cleanup. Bug: http://curl.haxx.se/bug/view.cgi?id=1362 Reported-by: Tristan
Diffstat (limited to 'lib/easy.c')
-rw-r--r--lib/easy.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/easy.c b/lib/easy.c
index c124e25de..82dea904b 100644
--- a/lib/easy.c
+++ b/lib/easy.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -299,9 +299,13 @@ CURLcode curl_global_init_mem(long flags, curl_malloc_callback m,
if(!m || !f || !r || !s || !c)
return CURLE_FAILED_INIT;
- /* Already initialized, don't do it again */
- if(initialized)
+ if(initialized) {
+ /* Already initialized, don't do it again, but bump the variable anyway to
+ work like curl_global_init() and require the same amount of cleanup
+ calls. */
+ initialized++;
return CURLE_OK;
+ }
/* Call the actual init function first */
code = curl_global_init(flags);