Remove blocks checking whether isc_mem_get() failed using the coccinelle

This commit is contained in:
Ondřej Surý
2019-07-16 15:52:14 +02:00
parent f63e696967
commit ae83801e2b
133 changed files with 151 additions and 1717 deletions

View File

@@ -231,8 +231,6 @@ load(const char *filename, const char *origintext, bool cache) {
unsigned int i;
dbi = isc_mem_get(mctx, sizeof(*dbi));
if (dbi == NULL)
return (ISC_R_NOMEMORY);
dbi->db = NULL;
dbi->version = NULL;

View File

@@ -55,10 +55,6 @@ create_name(char *s) {
* name structure.
*/
name = isc_mem_get(mctx, sizeof(*name) + DNSNAMELEN);
if (name == NULL) {
printf("out of memory!\n");
return (NULL);
}
dns_name_init(name, NULL);
isc_buffer_init(&target, name + 1, DNSNAMELEN);

View File

@@ -104,11 +104,10 @@ my_recv(isc_task_t *task, isc_event_t *event) {
snprintf(buf, sizeof(buf), "\r\nReceived: %.*s\r\n\r\n",
(int)dev->n, (char *)region.base);
region.base = isc_mem_get(mctx, strlen(buf) + 1);
if (region.base != NULL) {
{
region.length = strlen(buf) + 1;
strlcpy((char *)region.base, buf, region.length);
} else
region.length = 0;
}
isc_socket_send(sock, &region, task, my_send, event->ev_arg);
} else {
region = dev->region;
@@ -177,11 +176,9 @@ my_connect(isc_task_t *task, isc_event_t *event) {
"GET / HTTP/1.1\r\nHost: www.flame.org\r\n"
"Connection: Close\r\n\r\n");
region.base = isc_mem_get(mctx, strlen(buf) + 1);
if (region.base != NULL) {
{
region.length = strlen(buf) + 1;
strlcpy((char *)region.base, buf, region.length);
} else {
region.length = 0;
}
isc_socket_send(sock, &region, task, my_http_get, event->ev_arg);