debug("make_server(%s)", servname);
srv = isc_mem_allocate(mctx, sizeof(struct dig_server));
- if (srv == NULL)
- fatal("memory allocation failure in %s:%d",
- __FILE__, __LINE__);
strlcpy(srv->servername, servname, MXNAME);
strlcpy(srv->userarg, userarg, MXNAME);
ISC_LINK_INIT(srv, link);
INSIST(!free_now);
looknew = isc_mem_allocate(mctx, sizeof(struct dig_lookup));
- if (looknew == NULL)
- fatal("memory allocation failure in %s:%d",
- __FILE__, __LINE__);
looknew->pending = true;
looknew->textname[0] = 0;
looknew->cmdline[0] = 0;
size_t len = sizeof(looknew->ednsopts[0]) * EDNSOPT_OPTIONS;
size_t i;
looknew->ednsopts = isc_mem_allocate(mctx, len);
- if (looknew->ednsopts == NULL)
- fatal("out of memory");
for (i = 0; i < EDNSOPT_OPTIONS; i++) {
looknew->ednsopts[i].code = 0;
looknew->ednsopts[i].length = 0;
len = lookold->ednsopts[i].length;
if (len != 0) {
INSIST(lookold->ednsopts[i].value != NULL);
- looknew->ednsopts[i].value =
- isc_mem_allocate(mctx, len);
- if (looknew->ednsopts[i].value == NULL)
- fatal("out of memory");
+ looknew->ednsopts[i].value = isc_mem_allocate(mctx,
+ len);
memmove(looknew->ednsopts[i].value,
lookold->ednsopts[i].value, len);
}
if (lookold->ecs_addr != NULL) {
size_t len = sizeof(isc_sockaddr_t);
looknew->ecs_addr = isc_mem_allocate(mctx, len);
- if (looknew->ecs_addr == NULL)
- fatal("out of memory");
memmove(looknew->ecs_addr, lookold->ecs_addr, len);
}
isc_buffer_putstr(namebuf, keynametext);
secretsize = (unsigned int) strlen(keysecret) * 3 / 4;
secretstore = isc_mem_allocate(mctx, secretsize);
- if (secretstore == NULL)
- fatal("memory allocation failure in %s:%d",
- __FILE__, __LINE__);
isc_buffer_init(&secretbuf, secretstore, secretsize);
result = isc_base64_decodestring(keysecret, &secretbuf);
if (result != ISC_R_SUCCESS)
fatal("invalid prefix '%s'\n", value);
sa = isc_mem_allocate(mctx, sizeof(*sa));
- if (sa == NULL)
- fatal("out of memory");
memset(sa, 0, sizeof(*sa));
if (strcmp(buf, "0") == 0) {
make_searchlist_entry(char *domain) {
dig_searchlist_t *search;
search = isc_mem_allocate(mctx, sizeof(*search));
- if (search == NULL)
- fatal("memory allocation failure in %s:%d",
- __FILE__, __LINE__);
strlcpy(search->origin, domain, MXNAME);
search->origin[MXNAME-1] = 0;
ISC_LINK_INIT(search, link);
if (value != NULL) {
char *buf;
- buf = isc_mem_allocate(mctx, strlen(value)/2 + 1);
- if (buf == NULL)
- fatal("out of memory");
+ buf = isc_mem_allocate(mctx, strlen(value) / 2 + 1);
isc_buffer_init(&b, buf, (unsigned int) strlen(value)/2 + 1);
result = isc_hex_decodestring(value, &b);
check_result(result, "isc_hex_decodestring");
serv = ISC_LIST_NEXT(serv, link))
{
query = isc_mem_allocate(mctx, sizeof(dig_query_t));
- if (query == NULL) {
- fatal("memory allocation failure in %s:%d",
- __FILE__, __LINE__);
- }
debug("create query %p linked to lookup %p", query, lookup);
query->lookup = lookup;
query->timer = NULL;
fflush(stdout);
buf = isc_mem_allocate(mctx, COMMSIZE);
- if (buf == NULL)
- fatal("memory allocation failure");
isc_app_block();
if (interactive) {
#ifdef HAVE_READLINE
len = strlen(label) + 8;
l = isc_mem_allocate(mctx, len);
- if (l == NULL)
- fatal("cannot allocate memory");
snprintf(l, len, "pkcs11:%s", label);
isc_mem_free(mctx, label);
label = l;
free_output = true;
size = strlen(file) + strlen(".signed") + 1;
output = isc_mem_allocate(mctx, size);
- if (output == NULL)
- fatal("out of memory");
snprintf(output, size, "%s.signed", file);
}
len = strlen(dlzname) + 5;
cpval = isc_mem_allocate(mctx, len);
- if (cpval == NULL)
- return (ISC_R_NOMEMORY);
snprintf(cpval, len, "dlz %s", dlzname);
}
secretlen = strlen(secretstr) * 3 / 4;
secret = isc_mem_allocate(gmctx, secretlen);
- if (secret == NULL)
- fatal("out of memory");
isc_buffer_init(&secretbuf, secret, secretlen);
result = isc_base64_decodestring(secretstr, &secretbuf);
len = strlen(algorithm) + strlen(mykeyname) + strlen(secretstr) + 3;
keystr = isc_mem_allocate(mctx, len);
- if (keystr == NULL)
- fatal("out of memory");
snprintf(keystr, len, "%s:%s:%s", algorithm, mykeyname, secretstr);
setup_keystr();
}
secretlen = strlen(secretstr) * 3 / 4;
secret = isc_mem_allocate(gmctx, secretlen);
- if (secret == NULL)
- fatal("out of memory");
isc_buffer_init(&secretbuf, secret, secretlen);
result = isc_base64_decodestring(secretstr, &secretbuf);
size_t i;
query->ednsopts = isc_mem_allocate(mctx, len);
- if (query->ednsopts == NULL)
- fatal("out of memory");
for (i = 0; i < EDNSOPTS; i++) {
query->ednsopts[i].code = 0;
if (value != NULL) {
char *buf;
- buf = isc_mem_allocate(mctx, strlen(value)/2 + 1);
- if (buf == NULL) {
- fatal("out of memory");
- }
+ buf = isc_mem_allocate(mctx, strlen(value) / 2 + 1);
isc_buffer_init(&b, buf, strlen(value)/2 + 1);
result = isc_hex_decodestring(value, &b);
CHECK("isc_hex_decodestring", result);
}
sa = isc_mem_allocate(mctx, sizeof(*sa));
- if (sa == NULL)
- fatal("out of memory");
if (inet_pton(AF_INET6, buf, &in6) == 1) {
parsed = true;
isc_sockaddr_fromin6(sa, &in6, 0);
struct query *query;
query = isc_mem_allocate(mctx, sizeof(struct query));
- if (query == NULL)
- fatal("memory allocation failure in %s:%d",
- __FILE__, __LINE__);
memmove(query, &default_query, sizeof(struct query));
if (default_query.ecs_addr != NULL) {
size_t len = sizeof(isc_sockaddr_t);
query->ecs_addr = isc_mem_allocate(mctx, len);
- if (query->ecs_addr == NULL)
- fatal("memory allocation failure in %s:%d",
- __FILE__, __LINE__);
memmove(query->ecs_addr, default_query.ecs_addr, len);
}
if (cd->splitcnt > 0)
pathsize += len/cd->splitcnt;
- tmpPath = isc_mem_allocate(named_g_mctx , pathsize * sizeof(char));
- if (tmpPath == NULL) {
- /* write error message */
- isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
- DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
- "Filesystem driver unable to "
- "allocate memory in create_path().");
- result = ISC_R_NOMEMORY;
- goto cleanup_mem;
- }
+ tmpPath = isc_mem_allocate(named_g_mctx, pathsize * sizeof(char));
/*
* build path string.
/* allocate memory for data string */
data = isc_mem_allocate(named_g_mctx, len + 1);
- if (data == NULL) {
- isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
- DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
- "LDAP driver unable to allocate memory "
- "while processing results");
- result = ISC_R_FAILURE;
- goto cleanup;
- }
/*
* Make sure data is null termed at the beginning so
len = strlen(instr);
- outstr = isc_mem_allocate(named_g_mctx ,(2 * len * sizeof(char)) + 1);
- if (outstr == NULL)
- return NULL;
+ outstr = isc_mem_allocate(named_g_mctx, (2 * len * sizeof(char)) + 1);
mysql_real_escape_string(mysql, outstr, instr, len);
* term string
*/
tmpString = isc_mem_allocate(named_g_mctx, len + 1);
- if (tmpString == NULL) {
- /* major bummer, need more ram */
- isc_log_write(dns_lctx,
- DNS_LOGCATEGORY_DATABASE,
- DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
- "mysql driver unable "
- "to allocate memory for "
- "temporary string");
- mysql_free_result(rs);
- return (ISC_R_FAILURE); /* Yeah, I'd say! */
- }
/* copy field to tmpString */
strcpy(tmpString, safeGet(row[2]));
}
/* allocate memory, allow for NULL to term string */
tmpString = isc_mem_allocate(named_g_mctx, len + 1);
- if (tmpString == NULL) { /* we need more ram. */
- isc_log_write(dns_lctx,
- DNS_LOGCATEGORY_DATABASE,
- DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
- "mysql driver unable "
- "to allocate memory for "
- "temporary string");
- mysql_free_result(rs);
- return (ISC_R_FAILURE);
- }
/* copy this field to tmpString */
strcpy(tmpString, safeGet(row[3]));
/* concatonate the rest, with spaces between */
}
} else {
ndb = isc_mem_allocate(named_g_mctx, sizeof(odbc_db_t));
- if (ndb == NULL) {
- isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
- DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
- "Odbc driver unable to allocate memory");
- return ISC_R_NOMEMORY;
- }
memset(ndb, 0, sizeof(odbc_db_t));
}
len = strlen(instr);
- outstr = isc_mem_allocate(named_g_mctx ,(2 * len * sizeof(char)) + 1);
- if (outstr == NULL)
- return NULL;
+ outstr = isc_mem_allocate(named_g_mctx, (2 * len * sizeof(char)) + 1);
odbc_makesafe(outstr, instr, len);
/* allow for a "\n" at the end of the string/ */
data = isc_mem_allocate(named_g_mctx, ++totSize);
- if (data == NULL)
- return ISC_R_NOMEMORY;
result = ISC_R_FAILURE;
len = strlen(instr);
- outstr = isc_mem_allocate(named_g_mctx ,(2 * len * sizeof(char)) + 1);
- if (outstr == NULL)
- return NULL;
+ outstr = isc_mem_allocate(named_g_mctx, (2 * len * sizeof(char)) + 1);
postgres_makesafe(outstr, instr, len);
/* PQescapeString(outstr, instr, len); */
* term string
*/
tmpString = isc_mem_allocate(named_g_mctx, len + 1);
- if (tmpString == NULL) {
- /* major bummer, need more ram */
- isc_log_write(dns_lctx,
- DNS_LOGCATEGORY_DATABASE,
- DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
- "Postgres driver unable to "
- "allocate memory for "
- "temporary string");
- PQclear(rs);
- return (ISC_R_FAILURE); /* Yeah, I'd say! */
- }
/* copy field to tmpString */
strcpy(tmpString, PQgetvalue(rs, i, 2));
/*
}
/* allocate memory, allow for NULL to term string */
tmpString = isc_mem_allocate(named_g_mctx, len + 1);
- if (tmpString == NULL) { /* we need more ram. */
- isc_log_write(dns_lctx,
- DNS_LOGCATEGORY_DATABASE,
- DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
- "Postgres driver unable to "
- "allocate memory for "
- "temporary string");
- PQclear(rs);
- return (ISC_R_FAILURE);
- }
/* copy this field to tmpString */
strcpy(tmpString, PQgetvalue(rs, i, 3));
/* concatonate the rest, with spaces between */
/* allocate memory for the string */
qs = isc_mem_allocate(mctx, length + 1);
- /* couldn't allocate memory, We need more ram! */
- if (qs == NULL)
- return NULL;
*qs = 0;
/* start at the top of the list again */
*/
size = sizeof(*t) + name->length + rdata->length;
t = isc_mem_allocate(mctx, size);
- if (t == NULL)
- return (ISC_R_NOMEMORY);
t->mctx = NULL;
isc_mem_attach(mctx, &t->mctx);
t->op = op;
dnskey->data = keydata->data;
else {
dnskey->data = isc_mem_allocate(mctx, dnskey->datalen);
- if (dnskey->data == NULL)
- return (ISC_R_NOMEMORY);
memmove(dnskey->data, keydata->data, dnskey->datalen);
}
keydata->data = dnskey->data;
else {
keydata->data = isc_mem_allocate(mctx, keydata->datalen);
- if (keydata->data == NULL)
- return (ISC_R_NOMEMORY);
memmove(keydata->data, dnskey->data, keydata->datalen);
}
tempnamelen = strlen(file) + 20;
tempname = isc_mem_allocate(mctx, tempnamelen);
- if (tempname == NULL)
- return (ISC_R_NOMEMORY);
result = isc_file_mktemplate(file, tempname, tempnamelen);
if (result != ISC_R_SUCCESS)
isc_buffer_usedregion(&buf, ®);
p = isc_mem_allocate(mctx, reg.length + 1);
- if (p == NULL)
- return (ISC_R_NOMEMORY);
memmove(p, (char *) reg.base, (int) reg.length);
p[reg.length] = '\0';
#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
nlocks = CRYPTO_num_locks();
locks = isc_mem_allocate(dst__mctx, sizeof(isc_mutex_t) * nlocks);
- if (locks == NULL)
- return (ISC_R_NOMEMORY);
isc_mutexblock_init(locks, nlocks);
CRYPTO_set_locking_callback(lock_callback);
# if defined(LIBRESSL_VERSION_NUMBER)
if (mctx == NULL)
return (source);
copy = isc_mem_allocate(mctx, length);
- if (copy != NULL)
- memmove(copy, source, length);
+ memmove(copy, source, length);
return (copy);
}
/* format the buffer */
data = isc_mem_allocate(mctx, req_len);
- if (data == NULL) {
- close(fd);
- return (false);
- }
isc_buffer_init(&buf, data, req_len);
isc_buffer_putuint32(&buf, SSU_EXTERNAL_VERSION);
for (i = 0; i < zone->db_argc; i++)
size += strlen(zone->db_argv[i]) + 1;
mem = isc_mem_allocate(mctx, size);
- if (mem != NULL) {
+ {
tmp = mem;
tmp2 = mem;
base = mem;
tmp2 += strlen(tmp2) + 1;
}
*tmp = NULL;
- } else
- result = ISC_R_NOMEMORY;
+ }
UNLOCK_ZONE(zone);
*argv = mem;
return (result);
/* Calculate string length including '\0'. */
int len = strlen(zone->masterfile) + sizeof(".jnl");
journal = isc_mem_allocate(zone->mctx, len);
- if (journal == NULL)
- return (ISC_R_NOMEMORY);
strlcpy(journal, zone->masterfile, len);
strlcat(journal, ".jnl", len);
} else {
goto done;
array = isc_mem_allocate(zone->mctx, sizeof(char *) * zone->nincludes);
- if (array == NULL)
- goto done;
for (include = ISC_LIST_HEAD(zone->includes);
include != NULL;
include = ISC_LIST_NEXT(include, link)) {
} else if (slash != NULL) {
file = ++slash;
dir = isc_mem_allocate(mctx, slash - path);
- if (dir != NULL)
- strlcpy(dir, path, slash - path);
+ strlcpy(dir, path, slash - path);
} else {
file = path;
dir = isc_mem_strdup(mctx, ".");
} else if (slash != NULL) {
file = ++slash;
dir = isc_mem_allocate(mctx, slash - path);
- if (dir != NULL)
- strlcpy(dir, path, slash - path);
+ strlcpy(dir, path, slash - path);
} else {
file = path;
dir = isc_mem_strdup(mctx, ".");