return HTTP_ERROR_OUT_OF_MEMORY;
}
+ transaction->request = (__http_request_h *)malloc(sizeof(__http_request_h));
+ if (transaction->request == NULL) {
+ ERR("Fail to allocate request memory!!");
+ free(transaction);
+ return HTTP_ERROR_OUT_OF_MEMORY;
+ }
+
+ transaction->response = (__http_response_h *)malloc(sizeof(__http_response_h));
+ if (transaction->response == NULL) {
+ ERR("Fail to allocate response memory!!");
+ free(transaction->request);
+ free(transaction);
+ return HTTP_ERROR_OUT_OF_MEMORY;
+ }
+
+ transaction->header = (__http_header_h *)malloc(sizeof(__http_header_h));
+ if (transaction->header == NULL) {
+ ERR("Fail to allocate header memory!!");
+ free(transaction->response);
+ free(transaction->request);
+ free(transaction);
+ return HTTP_ERROR_OUT_OF_MEMORY;
+ }
+
transaction->easy_handle = NULL;
transaction->timer_event = 0;
transaction->interface_name = NULL;
transaction->session = http_session;
transaction->session->active_transaction_count++;
- transaction->request = (__http_request_h *)malloc(sizeof(__http_request_h));
- if (transaction->request == NULL) {
- ERR("Fail to allocate request memory!!");
- return HTTP_ERROR_OUT_OF_MEMORY;
- }
-
- transaction->response = (__http_response_h *)malloc(sizeof(__http_response_h));
- if (transaction->response == NULL) {
- ERR("Fail to allocate response memory!!");
- return HTTP_ERROR_OUT_OF_MEMORY;
- }
-
- transaction->header = (__http_header_h *)malloc(sizeof(__http_header_h));
- if (transaction->header == NULL) {
- ERR("Fail to allocate header memory!!");
- return HTTP_ERROR_OUT_OF_MEMORY;
- }
-
+ /* Header */
transaction->header->rsp_header_len = 0;
transaction->header->rsp_header = malloc(transaction->header->rsp_header_len + 1);
transaction->header->rsp_header[0] = '\0';
+ transaction->header->header_list = NULL;
+ transaction->header->hash_table = NULL;
transaction->header_event = FALSE;
+ /* Request */
transaction->request->host_uri = NULL;
transaction->request->method = _get_http_method(method);
if (method == HTTP_METHOD_PUT)
transaction->request->formpost = NULL;
transaction->request->lastptr = NULL;
+ /* Response */
transaction->response->status_text = NULL;
- transaction->header->header_list = NULL;
- transaction->header->hash_table = NULL;
-
*http_transaction = (http_transaction_h)transaction;
_add_transaction_to_list(transaction);
auth_transaction->request = (__http_request_h *)malloc(sizeof(__http_request_h));
if (auth_transaction->request == NULL) {
- free(auth_transaction->interface_name);
- free(auth_transaction->ca_path);
+ g_free(auth_transaction->interface_name);
+ g_free(auth_transaction->ca_path);
+ g_free(auth_transaction->realm);
free(auth_transaction);
ERR("Fail to allocate request memory!!");
return HTTP_ERROR_OUT_OF_MEMORY;
auth_transaction->response = (__http_response_h *)malloc(sizeof(__http_response_h));
if (auth_transaction->response == NULL) {
- free(auth_transaction->interface_name);
- free(auth_transaction->ca_path);
+ g_free(auth_transaction->interface_name);
+ g_free(auth_transaction->ca_path);
+ g_free(auth_transaction->realm);
free(auth_transaction->request);
free(auth_transaction);
ERR("Fail to allocate response memory!!");
auth_transaction->header = (__http_header_h *)malloc(sizeof(__http_header_h));
if (auth_transaction->header == NULL) {
- free(auth_transaction->interface_name);
- free(auth_transaction->ca_path);
+ g_free(auth_transaction->interface_name);
+ g_free(auth_transaction->ca_path);
+ g_free(auth_transaction->realm);
free(auth_transaction->request);
free(auth_transaction->response);
free(auth_transaction);