}
memset(curl_handle, 0, sizeof(php_curl));
- zend_llist_init(&curl_handle->to_free,sizeof(char *),curl_free_string,0);
+ zend_llist_init(&curl_handle->to_free, sizeof(char *), curl_free_string, 0);
curl_handle->cp = curl_easy_init();
if (!curl_handle->cp) {
CURLcode ret;
FILE *fp;
char buf[4096];
- int b;
+ int b,
+ is_temp_file;
unsigned long pos = 0;
if (ZEND_NUM_ARGS() != 1 ||
}
curl_easy_setopt(curl_handle->cp, CURLOPT_FILE, fp);
+
+ is_temp_file = 1;
} else if (curl_handle->return_transfer &&
curl_handle->output_file) {
} else {
RETURN_TRUE;
}
+
+ if (fp && is_temp_file)
+ fclose(fp);
}
php_write(buf, b);
}
+ if (is_temp_file)
+ fclose(fp);
+
} else {
char *ret_data;
}
ret_data[stat_sb.st_size - 1] = '\0';
+ if (is_temp_file)
+ fclose(fp);
+
RETURN_STRINGL(ret_data, stat_sb.st_size, 0);
}