summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSterling Hughes <sterling@bumblebury.com>2001-05-31 11:30:34 +0000
committerSterling Hughes <sterling@bumblebury.com>2001-05-31 11:30:34 +0000
commite051f904f2bb80474277ad792ee6077126b8890a (patch)
tree68196b41546273abcd2a0d3835fbf1e25d4c3fdb
parentf8d94a38495bcbe87e76218ffdb25655f79e4417 (diff)
downloadgnurl-e051f904f2bb80474277ad792ee6077126b8890a.tar.gz
gnurl-e051f904f2bb80474277ad792ee6077126b8890a.tar.bz2
gnurl-e051f904f2bb80474277ad792ee6077126b8890a.zip
Test and substance patch.
This is my first CVS commit :), what it does: - Makes sure that parts of the cURL library don't get initialized twice - Makes sure that we only free what we initialize
-rw-r--r--lib/easy.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/lib/easy.c b/lib/easy.c
index 4639bacd2..0099d6be1 100644
--- a/lib/easy.c
+++ b/lib/easy.c
@@ -78,17 +78,27 @@
#define _MPRINTF_REPLACE /* use our functions only */
#include <curl/mprintf.h>
+/* true globals */
+static unsigned int initialized = 0;
+static long init_flags = 0;
+
CURLcode curl_global_init(long flags)
{
if(flags & CURL_GLOBAL_SSL)
Curl_SSL_init();
+ initialized = 1;
+ init_flags = flags;
+
return CURLE_OK;
}
void curl_global_cleanup(void)
{
- Curl_SSL_cleanup();
+ if (init_flags & CURL_GLOBAL_SSL)
+ Curl_SSL_cleanup();
+
+ initialized = 0;
}
CURL *curl_easy_init(void)
@@ -97,7 +107,8 @@ CURL *curl_easy_init(void)
struct UrlData *data;
/* Make sure we inited the global SSL stuff */
- Curl_SSL_init();
+ if (!initialized)
+ curl_global_init(CURL_GLOBAL_DEFAULT);
/* We use curl_open() with undefined URL so far */
res = Curl_open((CURL **)&data, NULL);