if (type == FMWUP_HTTP_GET) {
curl_ret_code = curl_easy_setopt(curl, CURLOPT_HTTPGET, 1);
- retvm_if(CURLE_OK != curl_ret_code, -EIO, "Failed to curl_easy_setopt with CURLOPT_HTTPGET : ret_code[%d]", curl_ret_code);
+ if (CURLE_OK != curl_ret_code) {
+ _E("Failed to curl_easy_setopt with CURLOPT_HTTPGET : ret_code[%d]", curl_ret_code);
+ ret = -EIO;
+ goto END;
+ }
} else if (type == FMWUP_HTTP_POST) {
mime = curl_mime_init(curl);
- retvm_if(!mime, -EIO, "curl_mime_init: Failed to init mime");
+ if (!mime) {
+ _E("curl_mime_init: Failed to init mime");
+ ret = -EIO;
+ goto END;
+ }
curl_ret_code = curl_easy_setopt(curl, CURLOPT_MIMEPOST, mime);
if (curl_ret_code != CURLE_OK) {
- curl_mime_free(mime);
_E("Failed to curl_easy_setopt with CURLOPT_MIMEPOST : ret_code[%d]", curl_ret_code);
- return -EIO;
+ ret = -EIO;
+ goto END;
}
} else {
- return -1;
+ _E("Invalid http type: %d", type);
+ ret = -1;
+ goto END;
}
__curl_set_common_option(curl, (const char *)req_url, &response_header, &response_body);