cURL / Mailing Lists / curl-library / Single Mail

curl-library

file descriptors leak

From: Chih-Chung Chang <jochang_at_gmail.com>
Date: Thu, 7 Oct 2004 19:31:39 +0800

The following program prints "res=0" at first,
but after about 1000 lines it begins to print
"res=37" (CURLE_FILE_COULDNT_READ_FILE).
It seems each call to curl_easy_perform leaks
one file descriptor?
-----
#include <stdio.h>
#include <curl/curl.h>
int main()
{
  CURL *curl = curl_easy_init();
  curl_easy_setopt(curl, CURLOPT_URL, "file:///dev/null");
  while(1)
  {
      CURLcode res = curl_easy_perform(curl);
      printf("res=%d\n",res);
  }
  curl_easy_cleanup(curl);
  return 0;
}
-----
Thanks,
Chih-Chung Chang
Received on 2004-10-07