mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-22 10:10:06 +00:00
Use coccinelle to cleanup the failure handling blocks from isc_mem_allocate
This commit is contained in:
parent
3c1d4298af
commit
601cb4e4cc
@ -446,9 +446,6 @@ make_server(const char *servname, const char *userarg) {
|
||||
|
||||
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);
|
||||
@ -576,9 +573,6 @@ make_empty_lookup(void) {
|
||||
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;
|
||||
@ -681,8 +675,6 @@ cloneopts(dig_lookup_t *looknew, dig_lookup_t *lookold) {
|
||||
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;
|
||||
@ -696,10 +688,8 @@ cloneopts(dig_lookup_t *looknew, dig_lookup_t *lookold) {
|
||||
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);
|
||||
}
|
||||
@ -805,8 +795,6 @@ clone_lookup(dig_lookup_t *lookold, bool servers) {
|
||||
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);
|
||||
}
|
||||
|
||||
@ -865,9 +853,6 @@ setup_text_key(void) {
|
||||
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)
|
||||
@ -957,8 +942,6 @@ parse_netprefix(isc_sockaddr_t **sap, const char *value) {
|
||||
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) {
|
||||
@ -1190,9 +1173,6 @@ static dig_searchlist_t *
|
||||
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);
|
||||
@ -1456,9 +1436,7 @@ save_opt(dig_lookup_t *lookup, char *code, char *value) {
|
||||
|
||||
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");
|
||||
@ -2489,10 +2467,6 @@ setup_lookup(dig_lookup_t *lookup) {
|
||||
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;
|
||||
|
@ -850,8 +850,6 @@ get_next_command(void) {
|
||||
|
||||
fflush(stdout);
|
||||
buf = isc_mem_allocate(mctx, COMMSIZE);
|
||||
if (buf == NULL)
|
||||
fatal("memory allocation failure");
|
||||
isc_app_block();
|
||||
if (interactive) {
|
||||
#ifdef HAVE_READLINE
|
||||
|
@ -368,8 +368,6 @@ main(int argc, char **argv) {
|
||||
|
||||
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;
|
||||
|
@ -3577,8 +3577,6 @@ main(int argc, char *argv[]) {
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -963,8 +963,6 @@ named_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig,
|
||||
|
||||
len = strlen(dlzname) + 5;
|
||||
cpval = isc_mem_allocate(mctx, len);
|
||||
if (cpval == NULL)
|
||||
return (ISC_R_NOMEMORY);
|
||||
snprintf(cpval, len, "dlz %s", dlzname);
|
||||
}
|
||||
|
||||
|
@ -514,8 +514,6 @@ setup_keystr(void) {
|
||||
|
||||
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);
|
||||
@ -584,8 +582,6 @@ read_sessionkey(isc_mem_t *mctx, isc_log_t *lctx) {
|
||||
|
||||
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();
|
||||
|
||||
@ -1602,8 +1598,6 @@ evaluate_key(char *cmdline) {
|
||||
}
|
||||
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);
|
||||
|
@ -845,8 +845,6 @@ newopts(struct query *query) {
|
||||
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;
|
||||
@ -880,10 +878,7 @@ save_opt(struct query *query, char *code, char *value) {
|
||||
|
||||
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);
|
||||
@ -923,8 +918,6 @@ parse_netprefix(isc_sockaddr_t **sap, const char *value) {
|
||||
}
|
||||
|
||||
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);
|
||||
@ -1690,17 +1683,11 @@ clone_default_query() {
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -277,16 +277,7 @@ create_path(const char *zone, const char *host, const char *client,
|
||||
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.
|
||||
|
@ -363,14 +363,6 @@ ldap_process_results(LDAP *dbc, LDAPMessage *msg, char ** attrs,
|
||||
|
||||
/* 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
|
||||
|
@ -99,9 +99,7 @@ mysqldrv_escape_string(MYSQL *mysql, const char *instr) {
|
||||
|
||||
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);
|
||||
|
||||
@ -426,17 +424,6 @@ mysql_process_rs(dns_sdlzlookup_t *lookup, MYSQL_RES *rs)
|
||||
* 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]));
|
||||
|
||||
@ -654,16 +641,6 @@ mysql_allnodes(const char *zone, void *driverarg, void *dbdata,
|
||||
}
|
||||
/* 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 */
|
||||
|
@ -209,12 +209,6 @@ odbc_connect(odbc_instance_t *dbi, odbc_db_t **dbc) {
|
||||
}
|
||||
} 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));
|
||||
}
|
||||
|
||||
@ -335,9 +329,7 @@ odbc_escape_string(const char *instr) {
|
||||
|
||||
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);
|
||||
|
||||
@ -715,8 +707,6 @@ odbc_getManyFields(SQLHSTMT *stmnt, SQLSMALLINT startField,
|
||||
|
||||
/* 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;
|
||||
|
||||
|
@ -240,9 +240,7 @@ postgres_escape_string(const char *instr) {
|
||||
|
||||
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); */
|
||||
@ -676,17 +674,6 @@ postgres_process_rs(dns_sdlzlookup_t *lookup, PGresult *rs)
|
||||
* 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));
|
||||
/*
|
||||
@ -906,16 +893,6 @@ postgres_allnodes(const char *zone, void *driverarg, void *dbdata,
|
||||
}
|
||||
/* 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 */
|
||||
|
@ -296,9 +296,6 @@ sdlzh_build_querystring(isc_mem_t *mctx, query_list_t *querylist)
|
||||
|
||||
/* 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 */
|
||||
|
@ -66,8 +66,6 @@ dns_difftuple_create(isc_mem_t *mctx,
|
||||
*/
|
||||
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;
|
||||
|
@ -42,8 +42,6 @@ dns_keydata_todnskey(dns_rdata_keydata_t *keydata,
|
||||
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);
|
||||
}
|
||||
|
||||
@ -73,8 +71,6 @@ dns_keydata_fromdnskey(dns_rdata_keydata_t *keydata,
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -1804,8 +1804,6 @@ opentmp(isc_mem_t *mctx, dns_masterformat_t format, const char *file,
|
||||
|
||||
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)
|
||||
|
@ -2402,8 +2402,6 @@ dns_name_tostring(const dns_name_t *name, char **target, isc_mem_t *mctx) {
|
||||
|
||||
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';
|
||||
|
||||
|
@ -113,8 +113,6 @@ dst__openssl_init(isc_mem_t *mctx, const char *engine) {
|
||||
#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)
|
||||
|
@ -387,7 +387,6 @@ mem_maybedup(isc_mem_t *mctx, void *source, size_t length) {
|
||||
if (mctx == NULL)
|
||||
return (source);
|
||||
copy = isc_mem_allocate(mctx, length);
|
||||
if (copy != NULL)
|
||||
memmove(copy, source, length);
|
||||
|
||||
return (copy);
|
||||
|
@ -190,10 +190,6 @@ dns_ssu_external_match(const dns_name_t *identity,
|
||||
|
||||
/* 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);
|
||||
|
@ -1421,7 +1421,7 @@ dns_zone_getdbtype(dns_zone_t *zone, char ***argv, isc_mem_t *mctx) {
|
||||
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;
|
||||
@ -1432,8 +1432,7 @@ dns_zone_getdbtype(dns_zone_t *zone, char ***argv, isc_mem_t *mctx) {
|
||||
tmp2 += strlen(tmp2) + 1;
|
||||
}
|
||||
*tmp = NULL;
|
||||
} else
|
||||
result = ISC_R_NOMEMORY;
|
||||
}
|
||||
UNLOCK_ZONE(zone);
|
||||
*argv = mem;
|
||||
return (result);
|
||||
@ -1671,8 +1670,6 @@ default_journal(dns_zone_t *zone) {
|
||||
/* 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 {
|
||||
@ -19701,8 +19698,6 @@ dns_zone_getincludes(dns_zone_t *zone, char ***includesp) {
|
||||
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)) {
|
||||
|
@ -629,7 +629,6 @@ isc_file_splitpath(isc_mem_t *mctx, const char *path, char **dirname,
|
||||
} else if (slash != NULL) {
|
||||
file = ++slash;
|
||||
dir = isc_mem_allocate(mctx, slash - path);
|
||||
if (dir != NULL)
|
||||
strlcpy(dir, path, slash - path);
|
||||
} else {
|
||||
file = path;
|
||||
|
@ -714,7 +714,6 @@ isc_file_splitpath(isc_mem_t *mctx, const char *path, char **dirname,
|
||||
} else if (slash != NULL) {
|
||||
file = ++slash;
|
||||
dir = isc_mem_allocate(mctx, slash - path);
|
||||
if (dir != NULL)
|
||||
strlcpy(dir, path, slash - path);
|
||||
} else {
|
||||
file = path;
|
||||
|
Loading…
x
Reference in New Issue
Block a user