diff options
author | Daniel Stenberg <daniel@haxx.se> | 2015-10-09 16:04:11 +0200 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2015-10-09 16:04:11 +0200 |
commit | 6f8ecea0594faa24e738be53dbf2b512f2168a04 (patch) | |
tree | 0661a7de1986b9d4fc5e5a3348acf0179931dc65 | |
parent | 048f84637f9d2dcdbf889a7a0a1e2780aac687b7 (diff) |
curl_global_init_mem: set function pointers before doing init
... as in the polarssl TLS backend for example it uses memory functions.
-rw-r--r-- | lib/easy.c | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/lib/easy.c b/lib/easy.c index 316acb1d1..8b1fc0371 100644 --- a/lib/easy.c +++ b/lib/easy.c @@ -292,8 +292,6 @@ CURLcode curl_global_init_mem(long flags, curl_malloc_callback m, curl_free_callback f, curl_realloc_callback r, curl_strdup_callback s, curl_calloc_callback c) { - CURLcode result = CURLE_OK; - /* Invalid input, return immediately */ if(!m || !f || !r || !s || !c) return CURLE_FAILED_INIT; @@ -306,17 +304,16 @@ CURLcode curl_global_init_mem(long flags, curl_malloc_callback m, return CURLE_OK; } - /* Call the actual init function first */ - result = curl_global_init(flags); - if(!result) { - Curl_cmalloc = m; - Curl_cfree = f; - Curl_cstrdup = s; - Curl_crealloc = r; - Curl_ccalloc = c; - } + /* set memory functions before global_init() in case it wants memory + functions */ + Curl_cmalloc = m; + Curl_cfree = f; + Curl_cstrdup = s; + Curl_crealloc = r; + Curl_ccalloc = c; - return result; + /* Call the actual init function */ + return curl_global_init(flags); } /** |