]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Move thread-unsafe initializer to the module loading code; add the
authorTilghman Lesher <tilghman@meg.abyt.es>
Tue, 31 Oct 2006 15:46:04 +0000 (15:46 +0000)
committerTilghman Lesher <tilghman@meg.abyt.es>
Tue, 31 Oct 2006 15:46:04 +0000 (15:46 +0000)
corresponding function to the module unload to fix a memory leak.

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.2@46662 65c4cc65-6c06-0410-ace0-fbb531ad65f3

apps/app_curl.c

index 5cf4b167df1b66526c1aec46a0cc9033cad8bfb8..93fdd7ff01e2e1b18d155bfd41bd1c62f3ac50fa 100644 (file)
@@ -94,7 +94,6 @@ static int curl_internal(struct MemoryStruct *chunk, char *url, char *post)
 {
        CURL *curl;
 
-       curl_global_init(CURL_GLOBAL_ALL);
        curl = curl_easy_init();
 
        if (!curl) {
@@ -224,6 +223,7 @@ int unload_module(void)
        res |= ast_unregister_application(app);
 
        STANDARD_HANGUP_LOCALUSERS;
+       curl_global_cleanup();
        
        return res;
 }
@@ -232,6 +232,7 @@ int load_module(void)
 {
        int res;
 
+       curl_global_init(CURL_GLOBAL_ALL);
        res = ast_custom_function_register(&acf_curl);
        res |= ast_register_application(app, curl_exec, synopsis, descrip);