Implicitly inserted capwap_outofmemory() into the capwap_alloc().
capwap_alloc() can never return NULL.
This commit is contained in:
@ -310,10 +310,6 @@ static int ac_parsing_configuration_1_0(config_t* config) {
|
||||
desc->length = lengthValue;
|
||||
|
||||
desc->data = (uint8_t*)capwap_alloc(desc->length + 1);
|
||||
if (!desc->data) {
|
||||
capwap_outofmemory();
|
||||
}
|
||||
|
||||
strcpy((char*)desc->data, configValue);
|
||||
desc->data[desc->length] = 0;
|
||||
} else {
|
||||
|
@ -130,10 +130,6 @@ static struct ac_soap_response* ac_dfa_state_configure_parsing_request(struct ac
|
||||
/* Get JSON param and convert base64 */
|
||||
jsonmessage = json_object_to_json_string(jsonparam);
|
||||
base64confstatus = capwap_alloc(AC_BASE64_ENCODE_LENGTH(strlen(jsonmessage)));
|
||||
if (!base64confstatus) {
|
||||
capwap_outofmemory();
|
||||
}
|
||||
|
||||
ac_base64_string_encode(jsonmessage, base64confstatus);
|
||||
|
||||
/* Send message */
|
||||
|
@ -70,10 +70,6 @@ static struct ac_soap_response* ac_dfa_state_datacheck_parsing_request(struct ac
|
||||
/* Get JSON param and convert base64 */
|
||||
jsonmessage = json_object_to_json_string(jsonparam);
|
||||
base64confstatus = capwap_alloc(AC_BASE64_ENCODE_LENGTH(strlen(jsonmessage)));
|
||||
if (!base64confstatus) {
|
||||
capwap_outofmemory();
|
||||
}
|
||||
|
||||
ac_base64_string_encode(jsonmessage, base64confstatus);
|
||||
|
||||
/* Send message */
|
||||
|
@ -33,10 +33,6 @@ static struct ac_soap_response* ac_dfa_state_join_parsing_request(struct ac_sess
|
||||
/* Get JSON param and convert base64 */
|
||||
jsonmessage = json_object_to_json_string(jsonparam);
|
||||
base64confstatus = capwap_alloc(AC_BASE64_ENCODE_LENGTH(strlen(jsonmessage)));
|
||||
if (!base64confstatus) {
|
||||
capwap_outofmemory();
|
||||
}
|
||||
|
||||
ac_base64_string_encode(jsonmessage, base64confstatus);
|
||||
|
||||
/* Send message */
|
||||
|
@ -155,11 +155,6 @@ char* ac_get_printable_wtpid(struct capwap_wtpboarddata_element* wtpboarddata) {
|
||||
if (wtpboarddatamacaddress != NULL) {
|
||||
if (wtpboarddatamacaddress->length == MACADDRESS_EUI48_LENGTH) {
|
||||
wtpid = capwap_alloc(18);
|
||||
if (!wtpid) {
|
||||
capwap_outofmemory();
|
||||
}
|
||||
|
||||
/* */
|
||||
sprintf(wtpid, "%02x:%02x:%02x:%02x:%02x:%02x",
|
||||
(unsigned char)wtpboarddatamacaddress->data[0],
|
||||
(unsigned char)wtpboarddatamacaddress->data[1],
|
||||
@ -169,11 +164,6 @@ char* ac_get_printable_wtpid(struct capwap_wtpboarddata_element* wtpboarddata) {
|
||||
(unsigned char)wtpboarddatamacaddress->data[5]);
|
||||
} else if (wtpboarddatamacaddress->length == MACADDRESS_EUI64_LENGTH) {
|
||||
wtpid = capwap_alloc(24);
|
||||
if (!wtpid) {
|
||||
capwap_outofmemory();
|
||||
}
|
||||
|
||||
/* */
|
||||
sprintf(wtpid, "%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x",
|
||||
(unsigned char)wtpboarddatamacaddress->data[0],
|
||||
(unsigned char)wtpboarddatamacaddress->data[1],
|
||||
@ -513,9 +503,6 @@ int ac_execute(void) {
|
||||
|
||||
/* Configure poll struct */
|
||||
fds = (struct pollfd*)capwap_alloc(sizeof(struct pollfd) * fdscount);
|
||||
if (!fds) {
|
||||
capwap_outofmemory();
|
||||
}
|
||||
|
||||
/* Retrive all socket for polling */
|
||||
fdscount = capwap_network_set_pollfd(&g_ac.net, fds, fdscount);
|
||||
|
@ -136,10 +136,6 @@ static int ac_soapclient_parsing_url(struct ac_http_soap_server* server, const c
|
||||
/* Retrieve hostname */
|
||||
hostlength = port - protocol;
|
||||
server->host = capwap_alloc(hostlength + 1);
|
||||
if (!server->host) {
|
||||
capwap_outofmemory();
|
||||
}
|
||||
|
||||
strncpy(server->host, &url[protocol], hostlength);
|
||||
server->host[hostlength] = 0;
|
||||
|
||||
@ -165,10 +161,6 @@ static int ac_soapclient_parsing_url(struct ac_http_soap_server* server, const c
|
||||
}
|
||||
|
||||
server->path = capwap_alloc(pathlength + 1);
|
||||
if (!server->path) {
|
||||
capwap_outofmemory();
|
||||
}
|
||||
|
||||
if (length == port) {
|
||||
strcpy(server->path, "/");
|
||||
} else {
|
||||
@ -216,9 +208,6 @@ static int ac_soapclient_send_http(struct ac_http_soap_request* httprequest, cha
|
||||
/* Calculate header length */
|
||||
headerlength = 150 + length + strlen(httprequest->server->path) + strlen(httprequest->server->host) + strlen(datetime) + strlen((soapaction ? soapaction : ""));
|
||||
buffer = capwap_alloc(headerlength);
|
||||
if (!buffer) {
|
||||
capwap_outofmemory();
|
||||
}
|
||||
|
||||
/* HTTP headers */
|
||||
result = snprintf(buffer, headerlength,
|
||||
@ -429,10 +418,6 @@ struct ac_http_soap_server* ac_soapclient_create_server(const char* url) {
|
||||
|
||||
/* */
|
||||
server = (struct ac_http_soap_server*)capwap_alloc(sizeof(struct ac_http_soap_server));
|
||||
if (!server) {
|
||||
capwap_outofmemory();
|
||||
}
|
||||
|
||||
memset(server, 0, sizeof(struct ac_http_soap_server));
|
||||
|
||||
/* */
|
||||
@ -473,10 +458,6 @@ struct ac_soap_request* ac_soapclient_create_request(char* method, char* uriname
|
||||
|
||||
/* */
|
||||
request = (struct ac_soap_request*)capwap_alloc(sizeof(struct ac_soap_request));
|
||||
if (!request) {
|
||||
capwap_outofmemory();
|
||||
}
|
||||
|
||||
memset(request, 0, sizeof(struct ac_soap_request));
|
||||
|
||||
/* Build XML SOAP Request */
|
||||
@ -498,11 +479,6 @@ struct ac_soap_request* ac_soapclient_create_request(char* method, char* uriname
|
||||
|
||||
/* Create request */
|
||||
tagMethod = capwap_alloc(strlen(method) + 5);
|
||||
if (!tagMethod) {
|
||||
capwap_outofmemory();
|
||||
}
|
||||
|
||||
/* Append Request */
|
||||
sprintf(tagMethod, "tns:%s", method);
|
||||
request->xmlRequest = xmlNewChild(request->xmlBody, NULL, BAD_CAST tagMethod, NULL);
|
||||
capwap_free(tagMethod);
|
||||
@ -582,12 +558,9 @@ struct ac_http_soap_request* ac_soapclient_prepare_request(struct ac_soap_reques
|
||||
|
||||
/* */
|
||||
httprequest = (struct ac_http_soap_request*)capwap_alloc(sizeof(struct ac_http_soap_request));
|
||||
if (!httprequest) {
|
||||
capwap_outofmemory();
|
||||
}
|
||||
memset(httprequest, 0, sizeof(struct ac_http_soap_request));
|
||||
|
||||
/* */
|
||||
memset(httprequest, 0, sizeof(struct ac_http_soap_request));
|
||||
httprequest->request = request;
|
||||
httprequest->server = server;
|
||||
httprequest->requesttimeout = SOAP_PROTOCOL_REQUEST_TIMEOUT;
|
||||
@ -683,10 +656,6 @@ struct ac_soap_response* ac_soapclient_recv_response(struct ac_http_soap_request
|
||||
|
||||
/* */
|
||||
response = (struct ac_soap_response*)capwap_alloc(sizeof(struct ac_soap_response));
|
||||
if (!response) {
|
||||
capwap_outofmemory();
|
||||
}
|
||||
|
||||
memset(response, 0, sizeof(struct ac_soap_response));
|
||||
|
||||
/* Receive HTTP response into XML callback */
|
||||
@ -715,10 +684,6 @@ struct ac_soap_response* ac_soapclient_recv_response(struct ac_http_soap_request
|
||||
/* Retrieve response */
|
||||
if (response->responsecode == HTTP_RESULT_OK) {
|
||||
char* tagMethod = capwap_alloc(strlen(httprequest->request->method) + 9);
|
||||
if (!tagMethod) {
|
||||
capwap_outofmemory();
|
||||
}
|
||||
|
||||
sprintf(tagMethod, "%sResponse", httprequest->request->method);
|
||||
response->xmlResponse = ac_xml_search_child(response->xmlBody, NULL, tagMethod);
|
||||
capwap_free(tagMethod);
|
||||
|
Reference in New Issue
Block a user