$ git clone http://tcclient.ion.nu/tc_client.git
commit 68084b775cc6f8729a59b78ec15bf68a54756226
Author: Alicia <...>
Date:   Sat Feb 4 10:39:01 2017 +0100

    Call curl_easy_cleanup() at the end of the session to make sure cookies get written.

diff --git a/ChangeLog b/ChangeLog
index 0b49250..3ad6f6e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -5,6 +5,7 @@ Small bugfix regarding outgoing streams.
 Cleaned up no-longer-needed headers in client.c
 Don't bother trying to verify certificates on windows (lacking a ca bundle)
 Fixed tinychat account support.
+Call curl_easy_cleanup() at the end of the session to make sure cookies get written.
 modbot: use https instead of http and use the tcclient subdomain since some DNSes have trouble with underscores.
 modbot: added an option (--no-unapproved) to not add any unapproved videos to queue (videos still get approved by mods requesting or playing them manually)
 tc_client-gtk: fixed a race-condition in the builtin video player.
diff --git a/client.c b/client.c
index 7b1da57..65f197e 100644
--- a/client.c
+++ b/client.c
@@ -66,9 +66,9 @@ size_t writehttp(char* ptr, size_t size, size_t nmemb, void* x)
 }
 
 const char* cookiefile="";
+static CURL* curl=0;
 char* http_get(const char* url, const char* post)
 {
-  static CURL* curl=0;
   if(!curl){curl=curl_easy_init();}
   if(!curl){return 0;}
   curl_easy_setopt(curl, CURLOPT_URL, url);
@@ -509,6 +509,7 @@ int main(int argc, char** argv)
     amf_free(amfin);
   }
   free(rtmp.buf);
+  curl_easy_cleanup(curl);
   close(sock);
   return 0;
 }